User Guide
all.hpp
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) 2018-2019 Blue Brain Project
3  *
4  * This file is part of NMODL distributed under the terms of the GNU
5  * Lesser General Public License. See top-level LICENSE file for details.
6  *************************************************************************/
7 
8 ///
9 /// THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
10 ///
11 
12 #pragma once
13 
14 /**
15  * \dir
16  * \brief Auto generated AST Implementations
17  *
18  * \file
19  * \brief Auto generated AST classes declaration
20  */
21 
22 #include "ast/ast.hpp"
23 
24 #ifndef NMODL_AST_NODE_HPP
25 #define NMODL_AST_NODE_HPP
26 
27 
28 namespace nmodl {
29 namespace ast {
30 
31 /**
32  * @addtogroup ast_class
33  * @ingroup ast
34  * @{
35  */
36 
37 /**
38  * \brief Base class for all AST node
39  *
40  * Base class for all nodes in the AST. This can replace ast::Ast in
41  * the next refactoring.
42  *
43 */
44 class Node : public Ast {
45 
46  public:
47 
48  /// \name Ctor & dtor
49  /// \{
50 
51 
52 
53  virtual ~Node() = default;
54 
55  /// \}
56 
57 
58 
59 
60 
61 
62  /**
63  * \brief Check if the ast node is an instance of ast::Node
64  * \return true as object is of type ast::Node
65  */
66  bool is_node () const noexcept override {
67  return true;
68  }
69 
70  /**
71  * \brief Return a copy of the current node
72  *
73  * Recursively make a new copy/clone of the current node including
74  * all members and return a pointer to the node. This is used for
75  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
76  * ast.
77  *
78  * @return pointer to the clone/copy of the current node
79  */
80  virtual Node* clone() const override {
81  return new Node(*this);
82  }
83 
84  /// \name Getters
85  /// \{
86 
87  /**
88  * \brief Return type (ast::AstNodeType) of ast node
89  *
90  * Every node in the ast has a type defined in ast::AstNodeType and this
91  * function is used to retrieve the same.
92  *
93  * \return ast node type i.e. ast::AstNodeType::NODE
94  *
95  * \sa Ast::get_node_type_name
96  */
97  virtual AstNodeType get_node_type() const noexcept override {
98  return AstNodeType::NODE;
99  }
100 
101  /**
102  * \brief Return type (ast::AstNodeType) of ast node as std::string
103  *
104  * Every node in the ast has a type defined in ast::AstNodeType.
105  * This type name can be returned as a std::string for printing
106  * node to text/json form.
107  *
108  * \return name of the node type as a string i.e. "Node"
109  *
110  * \sa Ast::get_node_name
111  */
112  virtual std::string get_node_type_name() const noexcept override {
113  return "Node";
114  }
115 
116 
117  /**
118  * \brief Get std::shared_ptr from `this` pointer of the current ast node
119  */
120  virtual std::shared_ptr<Ast> get_shared_ptr() override {
121  return std::static_pointer_cast<Node>(shared_from_this());
122  }
123 
124  /**
125  * \brief Get std::shared_ptr from `this` pointer of the current ast node
126  */
127  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
128  return std::static_pointer_cast<const Node>(shared_from_this());
129  }
130 
131 
132 
133 
134 
135  /// \}
136 
137 
138 
139 
140 
141 
142 
143 
144 
145  /// \name Visitor
146  /// \{
147 
148  /**
149  * \brief visit children i.e. member variables of current node using provided visitor
150  *
151  * Different nodes in the AST have different members (i.e. children). This method
152  * recursively visits children using provided visitor.
153  *
154  * \param v Concrete visitor that will be used to recursively visit children
155  *
156  * \sa Ast::visit_children for example.
157  */
158  virtual void visit_children(visitor::Visitor& v) override;
159 
160  /**
161  * \brief visit children i.e. member variables of current node using provided visitor
162  *
163  * Different nodes in the AST have different members (i.e. children). This method
164  * recursively visits children using provided visitor.
165  *
166  * \param v Concrete constant visitor that will be used to recursively visit children
167  *
168  * \sa Ast::visit_children for example.
169  */
170  virtual void visit_children(visitor::ConstVisitor& v) const override;
171 
172  /**
173  * \brief accept (or visit) the current AST node using provided visitor
174  *
175  * Instead of visiting children of AST node, like Ast::visit_children,
176  * accept allows to visit the current node itself using provided concrete
177  * visitor.
178  *
179  * \param v Concrete visitor that will be used to recursively visit node
180  *
181  * \sa Ast::accept for example.
182  */
183  virtual void accept(visitor::Visitor& v) override;
184 
185  /**
186  * \copydoc accept(visitor::Visitor&)
187  */
188  virtual void accept(visitor::ConstVisitor& v) const override;
189 
190  /// \}
191 
192 
193 
194 };
195 
196 /** @} */ // end of ast_class
197 
198 
199 } // namespace ast
200 } // namespace nmodl
201 #endif // !NMODL_AST_NODE_HPP
202 #ifndef NMODL_AST_STATEMENT_HPP
203 #define NMODL_AST_STATEMENT_HPP
204 
205 
206 namespace nmodl {
207 namespace ast {
208 
209 /**
210  * @addtogroup ast_class
211  * @ingroup ast
212  * @{
213  */
214 
215 /**
216  * \brief TODO
217  *
218  *
219 */
220 class Statement : public Node {
221 
222  public:
223 
224  /// \name Ctor & dtor
225  /// \{
226 
227 
228 
229  virtual ~Statement() = default;
230 
231  /// \}
232 
233 
234 
235 
236 
237 
238  /**
239  * \brief Check if the ast node is an instance of ast::Statement
240  * \return true as object is of type ast::Statement
241  */
242  bool is_statement () const noexcept override {
243  return true;
244  }
245 
246  /**
247  * \brief Return a copy of the current node
248  *
249  * Recursively make a new copy/clone of the current node including
250  * all members and return a pointer to the node. This is used for
251  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
252  * ast.
253  *
254  * @return pointer to the clone/copy of the current node
255  */
256  virtual Statement* clone() const override {
257  return new Statement(*this);
258  }
259 
260  /// \name Getters
261  /// \{
262 
263  /**
264  * \brief Return type (ast::AstNodeType) of ast node
265  *
266  * Every node in the ast has a type defined in ast::AstNodeType and this
267  * function is used to retrieve the same.
268  *
269  * \return ast node type i.e. ast::AstNodeType::STATEMENT
270  *
271  * \sa Ast::get_node_type_name
272  */
273  virtual AstNodeType get_node_type() const noexcept override {
274  return AstNodeType::STATEMENT;
275  }
276 
277  /**
278  * \brief Return type (ast::AstNodeType) of ast node as std::string
279  *
280  * Every node in the ast has a type defined in ast::AstNodeType.
281  * This type name can be returned as a std::string for printing
282  * node to text/json form.
283  *
284  * \return name of the node type as a string i.e. "Statement"
285  *
286  * \sa Ast::get_node_name
287  */
288  virtual std::string get_node_type_name() const noexcept override {
289  return "Statement";
290  }
291 
292 
293  /**
294  * \brief Get std::shared_ptr from `this` pointer of the current ast node
295  */
296  virtual std::shared_ptr<Ast> get_shared_ptr() override {
297  return std::static_pointer_cast<Statement>(shared_from_this());
298  }
299 
300  /**
301  * \brief Get std::shared_ptr from `this` pointer of the current ast node
302  */
303  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
304  return std::static_pointer_cast<const Statement>(shared_from_this());
305  }
306 
307 
308 
309 
310 
311  /// \}
312 
313 
314 
315 
316 
317 
318 
319 
320 
321  /// \name Visitor
322  /// \{
323 
324  /**
325  * \brief visit children i.e. member variables of current node using provided visitor
326  *
327  * Different nodes in the AST have different members (i.e. children). This method
328  * recursively visits children using provided visitor.
329  *
330  * \param v Concrete visitor that will be used to recursively visit children
331  *
332  * \sa Ast::visit_children for example.
333  */
334  virtual void visit_children(visitor::Visitor& v) override;
335 
336  /**
337  * \brief visit children i.e. member variables of current node using provided visitor
338  *
339  * Different nodes in the AST have different members (i.e. children). This method
340  * recursively visits children using provided visitor.
341  *
342  * \param v Concrete constant visitor that will be used to recursively visit children
343  *
344  * \sa Ast::visit_children for example.
345  */
346  virtual void visit_children(visitor::ConstVisitor& v) const override;
347 
348  /**
349  * \brief accept (or visit) the current AST node using provided visitor
350  *
351  * Instead of visiting children of AST node, like Ast::visit_children,
352  * accept allows to visit the current node itself using provided concrete
353  * visitor.
354  *
355  * \param v Concrete visitor that will be used to recursively visit node
356  *
357  * \sa Ast::accept for example.
358  */
359  virtual void accept(visitor::Visitor& v) override;
360 
361  /**
362  * \copydoc accept(visitor::Visitor&)
363  */
364  virtual void accept(visitor::ConstVisitor& v) const override;
365 
366  /// \}
367 
368 
369 
370 };
371 
372 /** @} */ // end of ast_class
373 
374 
375 } // namespace ast
376 } // namespace nmodl
377 #endif // !NMODL_AST_STATEMENT_HPP
378 #ifndef NMODL_AST_EXPRESSION_HPP
379 #define NMODL_AST_EXPRESSION_HPP
380 
381 
382 namespace nmodl {
383 namespace ast {
384 
385 /**
386  * @addtogroup ast_class
387  * @ingroup ast
388  * @{
389  */
390 
391 /**
392  * \brief Base class for all expressions in the NMODL
393  *
394  * Base class for all expression types. This is one of the top level node
395  * in the AST representing higher level expression constructs. %Expressions
396  * can be a variable itself or complex binary expressions.
397  *
398  * \sa ast::Statement
399  *
400 */
401 class Expression : public Node {
402 
403  public:
404 
405  /// \name Ctor & dtor
406  /// \{
407 
408 
409 
410  virtual ~Expression() = default;
411 
412  /// \}
413 
414 
415 
416 
417 
418 
419  /**
420  * \brief Check if the ast node is an instance of ast::Expression
421  * \return true as object is of type ast::Expression
422  */
423  bool is_expression () const noexcept override {
424  return true;
425  }
426 
427  /**
428  * \brief Return a copy of the current node
429  *
430  * Recursively make a new copy/clone of the current node including
431  * all members and return a pointer to the node. This is used for
432  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
433  * ast.
434  *
435  * @return pointer to the clone/copy of the current node
436  */
437  virtual Expression* clone() const override {
438  return new Expression(*this);
439  }
440 
441  /// \name Getters
442  /// \{
443 
444  /**
445  * \brief Return type (ast::AstNodeType) of ast node
446  *
447  * Every node in the ast has a type defined in ast::AstNodeType and this
448  * function is used to retrieve the same.
449  *
450  * \return ast node type i.e. ast::AstNodeType::EXPRESSION
451  *
452  * \sa Ast::get_node_type_name
453  */
454  virtual AstNodeType get_node_type() const noexcept override {
456  }
457 
458  /**
459  * \brief Return type (ast::AstNodeType) of ast node as std::string
460  *
461  * Every node in the ast has a type defined in ast::AstNodeType.
462  * This type name can be returned as a std::string for printing
463  * node to text/json form.
464  *
465  * \return name of the node type as a string i.e. "Expression"
466  *
467  * \sa Ast::get_node_name
468  */
469  virtual std::string get_node_type_name() const noexcept override {
470  return "Expression";
471  }
472 
473 
474  /**
475  * \brief Get std::shared_ptr from `this` pointer of the current ast node
476  */
477  virtual std::shared_ptr<Ast> get_shared_ptr() override {
478  return std::static_pointer_cast<Expression>(shared_from_this());
479  }
480 
481  /**
482  * \brief Get std::shared_ptr from `this` pointer of the current ast node
483  */
484  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
485  return std::static_pointer_cast<const Expression>(shared_from_this());
486  }
487 
488 
489 
490 
491 
492  /// \}
493 
494 
495 
496 
497 
498 
499 
500 
501 
502  /// \name Visitor
503  /// \{
504 
505  /**
506  * \brief visit children i.e. member variables of current node using provided visitor
507  *
508  * Different nodes in the AST have different members (i.e. children). This method
509  * recursively visits children using provided visitor.
510  *
511  * \param v Concrete visitor that will be used to recursively visit children
512  *
513  * \sa Ast::visit_children for example.
514  */
515  virtual void visit_children(visitor::Visitor& v) override;
516 
517  /**
518  * \brief visit children i.e. member variables of current node using provided visitor
519  *
520  * Different nodes in the AST have different members (i.e. children). This method
521  * recursively visits children using provided visitor.
522  *
523  * \param v Concrete constant visitor that will be used to recursively visit children
524  *
525  * \sa Ast::visit_children for example.
526  */
527  virtual void visit_children(visitor::ConstVisitor& v) const override;
528 
529  /**
530  * \brief accept (or visit) the current AST node using provided visitor
531  *
532  * Instead of visiting children of AST node, like Ast::visit_children,
533  * accept allows to visit the current node itself using provided concrete
534  * visitor.
535  *
536  * \param v Concrete visitor that will be used to recursively visit node
537  *
538  * \sa Ast::accept for example.
539  */
540  virtual void accept(visitor::Visitor& v) override;
541 
542  /**
543  * \copydoc accept(visitor::Visitor&)
544  */
545  virtual void accept(visitor::ConstVisitor& v) const override;
546 
547  /// \}
548 
549 
550 
551 };
552 
553 /** @} */ // end of ast_class
554 
555 
556 } // namespace ast
557 } // namespace nmodl
558 #endif // !NMODL_AST_EXPRESSION_HPP
559 #ifndef NMODL_AST_BLOCK_HPP
560 #define NMODL_AST_BLOCK_HPP
561 
562 
563 namespace nmodl {
564 namespace ast {
565 
566 /**
567  * @addtogroup ast_class
568  * @ingroup ast
569  * @{
570  */
571 
572 /**
573  * \brief Base class for all block scoped nodes
574  *
575  * NMODL has different local and global block scoped nodes like
576  * ast::NeuronBlock, ast::ParamBlock, ast::IfStatement etc. Ast::Block
577  * is base class and defines common interface for these nodes.
578  *
579 */
580 class Block : public Expression {
581 
582  public:
583 
584  /// \name Ctor & dtor
585  /// \{
586 
587 
588 
589  virtual ~Block() = default;
590 
591  /// \}
592 
593  /// \name Not implemented
594  /// \{
595 
596  virtual const ArgumentVector& get_parameters() const {
597  throw std::runtime_error("get_parameters not implemented");
598  }
599 
600 
601  /// \}
602 
603  /**
604  * \brief Check if the ast node is an instance of ast::Block
605  * \return true as object is of type ast::Block
606  */
607  bool is_block () const noexcept override {
608  return true;
609  }
610 
611  /**
612  * \brief Return a copy of the current node
613  *
614  * Recursively make a new copy/clone of the current node including
615  * all members and return a pointer to the node. This is used for
616  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
617  * ast.
618  *
619  * @return pointer to the clone/copy of the current node
620  */
621  virtual Block* clone() const override {
622  return new Block(*this);
623  }
624 
625  /// \name Getters
626  /// \{
627 
628  /**
629  * \brief Return type (ast::AstNodeType) of ast node
630  *
631  * Every node in the ast has a type defined in ast::AstNodeType and this
632  * function is used to retrieve the same.
633  *
634  * \return ast node type i.e. ast::AstNodeType::BLOCK
635  *
636  * \sa Ast::get_node_type_name
637  */
638  virtual AstNodeType get_node_type() const noexcept override {
639  return AstNodeType::BLOCK;
640  }
641 
642  /**
643  * \brief Return type (ast::AstNodeType) of ast node as std::string
644  *
645  * Every node in the ast has a type defined in ast::AstNodeType.
646  * This type name can be returned as a std::string for printing
647  * node to text/json form.
648  *
649  * \return name of the node type as a string i.e. "Block"
650  *
651  * \sa Ast::get_node_name
652  */
653  virtual std::string get_node_type_name() const noexcept override {
654  return "Block";
655  }
656 
657 
658  /**
659  * \brief Get std::shared_ptr from `this` pointer of the current ast node
660  */
661  virtual std::shared_ptr<Ast> get_shared_ptr() override {
662  return std::static_pointer_cast<Block>(shared_from_this());
663  }
664 
665  /**
666  * \brief Get std::shared_ptr from `this` pointer of the current ast node
667  */
668  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
669  return std::static_pointer_cast<const Block>(shared_from_this());
670  }
671 
672 
673 
674 
675 
676  /// \}
677 
678 
679 
680 
681 
682 
683 
684 
685 
686  /// \name Visitor
687  /// \{
688 
689  /**
690  * \brief visit children i.e. member variables of current node using provided visitor
691  *
692  * Different nodes in the AST have different members (i.e. children). This method
693  * recursively visits children using provided visitor.
694  *
695  * \param v Concrete visitor that will be used to recursively visit children
696  *
697  * \sa Ast::visit_children for example.
698  */
699  virtual void visit_children(visitor::Visitor& v) override;
700 
701  /**
702  * \brief visit children i.e. member variables of current node using provided visitor
703  *
704  * Different nodes in the AST have different members (i.e. children). This method
705  * recursively visits children using provided visitor.
706  *
707  * \param v Concrete constant visitor that will be used to recursively visit children
708  *
709  * \sa Ast::visit_children for example.
710  */
711  virtual void visit_children(visitor::ConstVisitor& v) const override;
712 
713  /**
714  * \brief accept (or visit) the current AST node using provided visitor
715  *
716  * Instead of visiting children of AST node, like Ast::visit_children,
717  * accept allows to visit the current node itself using provided concrete
718  * visitor.
719  *
720  * \param v Concrete visitor that will be used to recursively visit node
721  *
722  * \sa Ast::accept for example.
723  */
724  virtual void accept(visitor::Visitor& v) override;
725 
726  /**
727  * \copydoc accept(visitor::Visitor&)
728  */
729  virtual void accept(visitor::ConstVisitor& v) const override;
730 
731  /// \}
732 
733 
734 
735 };
736 
737 /** @} */ // end of ast_class
738 
739 
740 } // namespace ast
741 } // namespace nmodl
742 #endif // !NMODL_AST_BLOCK_HPP
743 #ifndef NMODL_AST_IDENTIFIER_HPP
744 #define NMODL_AST_IDENTIFIER_HPP
745 
746 
747 namespace nmodl {
748 namespace ast {
749 
750 /**
751  * @addtogroup ast_class
752  * @ingroup ast
753  * @{
754  */
755 
756 /**
757  * \brief Base class for all identifiers
758  *
759  * Base class for all variable types like ast::Name, ast::PrimeName and ast::Argument.
760  *
761  * \sa ast::Number
762  *
763 */
764 class Identifier : public Expression {
765 
766  public:
767 
768  /// \name Ctor & dtor
769  /// \{
770 
771 
772 
773  virtual ~Identifier() = default;
774 
775  /// \}
776 
777 
778 
779 
780 
781 
782  /**
783  * \brief Check if the ast node is an instance of ast::Identifier
784  * \return true as object is of type ast::Identifier
785  */
786  bool is_identifier () const noexcept override {
787  return true;
788  }
789 
790  /**
791  * \brief Return a copy of the current node
792  *
793  * Recursively make a new copy/clone of the current node including
794  * all members and return a pointer to the node. This is used for
795  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
796  * ast.
797  *
798  * @return pointer to the clone/copy of the current node
799  */
800  virtual Identifier* clone() const override {
801  return new Identifier(*this);
802  }
803 
804  /// \name Getters
805  /// \{
806 
807  /**
808  * \brief Return type (ast::AstNodeType) of ast node
809  *
810  * Every node in the ast has a type defined in ast::AstNodeType and this
811  * function is used to retrieve the same.
812  *
813  * \return ast node type i.e. ast::AstNodeType::IDENTIFIER
814  *
815  * \sa Ast::get_node_type_name
816  */
817  virtual AstNodeType get_node_type() const noexcept override {
819  }
820 
821  /**
822  * \brief Return type (ast::AstNodeType) of ast node as std::string
823  *
824  * Every node in the ast has a type defined in ast::AstNodeType.
825  * This type name can be returned as a std::string for printing
826  * node to text/json form.
827  *
828  * \return name of the node type as a string i.e. "Identifier"
829  *
830  * \sa Ast::get_node_name
831  */
832  virtual std::string get_node_type_name() const noexcept override {
833  return "Identifier";
834  }
835 
836 
837  /**
838  * \brief Get std::shared_ptr from `this` pointer of the current ast node
839  */
840  virtual std::shared_ptr<Ast> get_shared_ptr() override {
841  return std::static_pointer_cast<Identifier>(shared_from_this());
842  }
843 
844  /**
845  * \brief Get std::shared_ptr from `this` pointer of the current ast node
846  */
847  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
848  return std::static_pointer_cast<const Identifier>(shared_from_this());
849  }
850 
851 
852 
853 
854 
855  /// \}
856 
857 
858 
859 
860 
861 
862 
863 
864 
865  /// \name Visitor
866  /// \{
867 
868  /**
869  * \brief visit children i.e. member variables of current node using provided visitor
870  *
871  * Different nodes in the AST have different members (i.e. children). This method
872  * recursively visits children using provided visitor.
873  *
874  * \param v Concrete visitor that will be used to recursively visit children
875  *
876  * \sa Ast::visit_children for example.
877  */
878  virtual void visit_children(visitor::Visitor& v) override;
879 
880  /**
881  * \brief visit children i.e. member variables of current node using provided visitor
882  *
883  * Different nodes in the AST have different members (i.e. children). This method
884  * recursively visits children using provided visitor.
885  *
886  * \param v Concrete constant visitor that will be used to recursively visit children
887  *
888  * \sa Ast::visit_children for example.
889  */
890  virtual void visit_children(visitor::ConstVisitor& v) const override;
891 
892  /**
893  * \brief accept (or visit) the current AST node using provided visitor
894  *
895  * Instead of visiting children of AST node, like Ast::visit_children,
896  * accept allows to visit the current node itself using provided concrete
897  * visitor.
898  *
899  * \param v Concrete visitor that will be used to recursively visit node
900  *
901  * \sa Ast::accept for example.
902  */
903  virtual void accept(visitor::Visitor& v) override;
904 
905  /**
906  * \copydoc accept(visitor::Visitor&)
907  */
908  virtual void accept(visitor::ConstVisitor& v) const override;
909 
910  /// \}
911 
912 
913 
914 };
915 
916 /** @} */ // end of ast_class
917 
918 
919 } // namespace ast
920 } // namespace nmodl
921 #endif // !NMODL_AST_IDENTIFIER_HPP
922 #ifndef NMODL_AST_NUMBER_HPP
923 #define NMODL_AST_NUMBER_HPP
924 
925 
926 namespace nmodl {
927 namespace ast {
928 
929 /**
930  * @addtogroup ast_class
931  * @ingroup ast
932  * @{
933  */
934 
935 /**
936  * \brief Base class for all numbers
937  *
938  * Base class for all number types like ast::Integer, ast::Float and ast::Double.
939  *
940 */
941 class Number : public Expression {
942 
943  public:
944 
945  /// \name Ctor & dtor
946  /// \{
947 
948 
949 
950  virtual ~Number() = default;
951 
952  /// \}
953 
954  /// \name Not implemented
955  /// \{
956 
957 
958  virtual double to_double() {
959  throw std::runtime_error("to_double not implemented");
960  }
961 
962  /// \}
963 
964  /**
965  * \brief Check if the ast node is an instance of ast::Number
966  * \return true as object is of type ast::Number
967  */
968  bool is_number () const noexcept override {
969  return true;
970  }
971 
972  /**
973  * \brief Return a copy of the current node
974  *
975  * Recursively make a new copy/clone of the current node including
976  * all members and return a pointer to the node. This is used for
977  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
978  * ast.
979  *
980  * @return pointer to the clone/copy of the current node
981  */
982  virtual Number* clone() const override {
983  return new Number(*this);
984  }
985 
986  /// \name Getters
987  /// \{
988 
989  /**
990  * \brief Return type (ast::AstNodeType) of ast node
991  *
992  * Every node in the ast has a type defined in ast::AstNodeType and this
993  * function is used to retrieve the same.
994  *
995  * \return ast node type i.e. ast::AstNodeType::NUMBER
996  *
997  * \sa Ast::get_node_type_name
998  */
999  virtual AstNodeType get_node_type() const noexcept override {
1000  return AstNodeType::NUMBER;
1001  }
1002 
1003  /**
1004  * \brief Return type (ast::AstNodeType) of ast node as std::string
1005  *
1006  * Every node in the ast has a type defined in ast::AstNodeType.
1007  * This type name can be returned as a std::string for printing
1008  * node to text/json form.
1009  *
1010  * \return name of the node type as a string i.e. "Number"
1011  *
1012  * \sa Ast::get_node_name
1013  */
1014  virtual std::string get_node_type_name() const noexcept override {
1015  return "Number";
1016  }
1017 
1018 
1019  /**
1020  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1021  */
1022  virtual std::shared_ptr<Ast> get_shared_ptr() override {
1023  return std::static_pointer_cast<Number>(shared_from_this());
1024  }
1025 
1026  /**
1027  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1028  */
1029  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
1030  return std::static_pointer_cast<const Number>(shared_from_this());
1031  }
1032 
1033 
1034 
1035 
1036 
1037  /// \}
1038 
1039 
1040 
1041 
1042 
1043 
1044 
1045 
1046 
1047  /// \name Visitor
1048  /// \{
1049 
1050  /**
1051  * \brief visit children i.e. member variables of current node using provided visitor
1052  *
1053  * Different nodes in the AST have different members (i.e. children). This method
1054  * recursively visits children using provided visitor.
1055  *
1056  * \param v Concrete visitor that will be used to recursively visit children
1057  *
1058  * \sa Ast::visit_children for example.
1059  */
1060  virtual void visit_children(visitor::Visitor& v) override;
1061 
1062  /**
1063  * \brief visit children i.e. member variables of current node using provided visitor
1064  *
1065  * Different nodes in the AST have different members (i.e. children). This method
1066  * recursively visits children using provided visitor.
1067  *
1068  * \param v Concrete constant visitor that will be used to recursively visit children
1069  *
1070  * \sa Ast::visit_children for example.
1071  */
1072  virtual void visit_children(visitor::ConstVisitor& v) const override;
1073 
1074  /**
1075  * \brief accept (or visit) the current AST node using provided visitor
1076  *
1077  * Instead of visiting children of AST node, like Ast::visit_children,
1078  * accept allows to visit the current node itself using provided concrete
1079  * visitor.
1080  *
1081  * \param v Concrete visitor that will be used to recursively visit node
1082  *
1083  * \sa Ast::accept for example.
1084  */
1085  virtual void accept(visitor::Visitor& v) override;
1086 
1087  /**
1088  * \copydoc accept(visitor::Visitor&)
1089  */
1090  virtual void accept(visitor::ConstVisitor& v) const override;
1091 
1092  /// \}
1093 
1094 
1095 
1096 };
1097 
1098 /** @} */ // end of ast_class
1099 
1100 
1101 } // namespace ast
1102 } // namespace nmodl
1103 #endif // !NMODL_AST_NUMBER_HPP
1104 #ifndef NMODL_AST_STRING_HPP
1105 #define NMODL_AST_STRING_HPP
1106 
1107 
1108 namespace nmodl {
1109 namespace ast {
1110 
1111 /**
1112  * @addtogroup ast_class
1113  * @ingroup ast
1114  * @{
1115  */
1116 
1117 /**
1118  * \brief Represents a string
1119  *
1120  * All statements encapsulating text block are stored in the AST as ast::String.
1121  * For example, nodes like ast::LineComment and ast::Verbatim block use ast::String::value
1122  * to store the underlying text:
1123  *
1124  * \code{.mod}
1125  * COMMENT
1126  * This text is stored as String
1127  * ENDCOMMENT
1128  *
1129  * VERBATIM
1130  * int *x;
1131  * *x = ...
1132  * ENDVERBATIM
1133  * \endcode
1134  *
1135 */
1136 class String : public Expression {
1137  private:
1138  /// Value of string
1139  std::string value;
1140  /// token with location information
1141  std::shared_ptr<ModToken> token;
1142 
1143  public:
1144 
1145  /// \name Ctor & dtor
1146  /// \{
1147 
1148  explicit String(const std::string& value);
1149  String(const String& obj);
1150 
1151  String() = default;
1152 
1153  virtual ~String() = default;
1154 
1155  /// \}
1156 
1157 
1158 
1159 
1160 
1161 
1162  /**
1163  * \brief Check if the ast node is an instance of ast::String
1164  * \return true as object is of type ast::String
1165  */
1166  bool is_string () const noexcept override {
1167  return true;
1168  }
1169 
1170  /**
1171  * \brief Return a copy of the current node
1172  *
1173  * Recursively make a new copy/clone of the current node including
1174  * all members and return a pointer to the node. This is used for
1175  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1176  * ast.
1177  *
1178  * @return pointer to the clone/copy of the current node
1179  */
1180  String* clone() const override {
1181  return new String(*this);
1182  }
1183 
1184  /// \name Getters
1185  /// \{
1186 
1187  /**
1188  * \brief Return type (ast::AstNodeType) of ast node
1189  *
1190  * Every node in the ast has a type defined in ast::AstNodeType and this
1191  * function is used to retrieve the same.
1192  *
1193  * \return ast node type i.e. ast::AstNodeType::STRING
1194  *
1195  * \sa Ast::get_node_type_name
1196  */
1197  AstNodeType get_node_type() const noexcept override {
1198  return AstNodeType::STRING;
1199  }
1200 
1201  /**
1202  * \brief Return type (ast::AstNodeType) of ast node as std::string
1203  *
1204  * Every node in the ast has a type defined in ast::AstNodeType.
1205  * This type name can be returned as a std::string for printing
1206  * node to text/json form.
1207  *
1208  * \return name of the node type as a string i.e. "String"
1209  *
1210  * \sa Ast::get_node_name
1211  */
1212  std::string get_node_type_name() const noexcept override {
1213  return "String";
1214  }
1215 
1216 
1217  /**
1218  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1219  */
1220  std::shared_ptr<Ast> get_shared_ptr() override {
1221  return std::static_pointer_cast<String>(shared_from_this());
1222  }
1223 
1224  /**
1225  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1226  */
1227  std::shared_ptr<const Ast> get_shared_ptr() const override {
1228  return std::static_pointer_cast<const String>(shared_from_this());
1229  }
1230 
1231  /**
1232  * \brief Return associated token for the current ast node
1233  *
1234  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
1235  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
1236  * nullptr to store in the nmodl::symtab::SymbolTable.
1237  *
1238  * \return pointer to token if exist otherwise nullptr
1239  */
1240  const ModToken* get_token() const noexcept override {
1241  return token.get();
1242  }
1243 
1244 
1245 
1246 
1247 
1248 
1249 
1250 
1251  /**
1252  * \brief Getter for member variable \ref String.value
1253  */
1254  const std::string& get_value() const noexcept {
1255  return value;
1256  }
1257 
1258 
1259 
1260  /// \}
1261 
1262  /// \name Setters
1263  /// \{
1264 
1265 
1266  /**
1267  * \brief Set token for the current ast node
1268  */
1269  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
1270 
1271 
1272  /**
1273  * \brief Set new value to the current ast node
1274  * \sa String::eval
1275  */
1276  void set(std::string _value) {
1277  value = _value;
1278  }
1279 
1280 
1281  /**
1282  * \brief Setter for member variable \ref String.value
1283  */
1284  void set_value(std::string value);
1285 
1286 
1287  /// \}
1288 
1289  /// \name Visitor
1290  /// \{
1291 
1292  /**
1293  * \brief visit children i.e. member variables of current node using provided visitor
1294  *
1295  * Different nodes in the AST have different members (i.e. children). This method
1296  * recursively visits children using provided visitor.
1297  *
1298  * \param v Concrete visitor that will be used to recursively visit children
1299  *
1300  * \sa Ast::visit_children for example.
1301  */
1302  void visit_children(visitor::Visitor& v) override;
1303 
1304  /**
1305  * \brief visit children i.e. member variables of current node using provided visitor
1306  *
1307  * Different nodes in the AST have different members (i.e. children). This method
1308  * recursively visits children using provided visitor.
1309  *
1310  * \param v Concrete constant visitor that will be used to recursively visit children
1311  *
1312  * \sa Ast::visit_children for example.
1313  */
1314  void visit_children(visitor::ConstVisitor& v) const override;
1315 
1316  /**
1317  * \brief accept (or visit) the current AST node using provided visitor
1318  *
1319  * Instead of visiting children of AST node, like Ast::visit_children,
1320  * accept allows to visit the current node itself using provided concrete
1321  * visitor.
1322  *
1323  * \param v Concrete visitor that will be used to recursively visit node
1324  *
1325  * \sa Ast::accept for example.
1326  */
1327  void accept(visitor::Visitor& v) override;
1328 
1329  /**
1330  * \copydoc accept(visitor::Visitor&)
1331  */
1332  void accept(visitor::ConstVisitor& v) const override;
1333 
1334  /// \}
1335 
1336 
1337  /**
1338  * \brief Return value of the ast node
1339  *
1340  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1341  * to their literal values. This method is used to access underlying
1342  * literal value.
1343  *
1344  * \sa String::set
1345  */
1346  std::string eval() const {
1347  return value;
1348  }
1349 
1350  private:
1351  /**
1352  * \brief Set this object as parent for all the children
1353  *
1354  * This should be called in every object (with children) constructor
1355  * to set parents. Since it is called only in the constructors it
1356  * should not be virtual to avoid ambiguities (issue #295).
1357  */
1358  void set_parent_in_children();
1359 };
1360 
1361 /** @} */ // end of ast_class
1362 
1363 
1364 } // namespace ast
1365 } // namespace nmodl
1366 #endif // !NMODL_AST_STRING_HPP
1367 #ifndef NMODL_AST_INTEGER_HPP
1368 #define NMODL_AST_INTEGER_HPP
1369 
1370 
1371 namespace nmodl {
1372 namespace ast {
1373 
1374 /**
1375  * @addtogroup ast_class
1376  * @ingroup ast
1377  * @{
1378  */
1379 
1380 /**
1381  * \brief Represents an integer variable
1382  *
1383  * Non floating value in the mod file is parsed as an integer. For example,
1384  * in the below code, integer literals like `0` and `11` are stored as ast::Integer
1385  * in the AST :
1386  *
1387  * \code{.mod}
1388  * FROM i=0 TO N {
1389  * tau = X[i] + 11
1390  * }
1391  * \endcode
1392  *
1393  * \sa ast::Float ast::Double
1394  *
1395 */
1396 class Integer : public Number {
1397  private:
1398  /// Value of integer
1399  int value;
1400  /// if integer is a macro then it's name
1401  std::shared_ptr<Name> macro;
1402  /// token with location information
1403  std::shared_ptr<ModToken> token;
1404 
1405  public:
1406 
1407  /// \name Ctor & dtor
1408  /// \{
1409 
1410  explicit Integer(int value, Name* macro);
1411  explicit Integer(int value, const std::shared_ptr<Name>& macro);
1412  Integer(const Integer& obj);
1413 
1414  Integer() = default;
1415 
1416  virtual ~Integer() = default;
1417 
1418  /// \}
1419 
1420 
1421 
1422 
1423 
1424 
1425  /**
1426  * \brief Check if the ast node is an instance of ast::Integer
1427  * \return true as object is of type ast::Integer
1428  */
1429  bool is_integer () const noexcept override {
1430  return true;
1431  }
1432 
1433  /**
1434  * \brief Return a copy of the current node
1435  *
1436  * Recursively make a new copy/clone of the current node including
1437  * all members and return a pointer to the node. This is used for
1438  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1439  * ast.
1440  *
1441  * @return pointer to the clone/copy of the current node
1442  */
1443  Integer* clone() const override {
1444  return new Integer(*this);
1445  }
1446 
1447  /// \name Getters
1448  /// \{
1449 
1450  /**
1451  * \brief Return type (ast::AstNodeType) of ast node
1452  *
1453  * Every node in the ast has a type defined in ast::AstNodeType and this
1454  * function is used to retrieve the same.
1455  *
1456  * \return ast node type i.e. ast::AstNodeType::INTEGER
1457  *
1458  * \sa Ast::get_node_type_name
1459  */
1460  AstNodeType get_node_type() const noexcept override {
1461  return AstNodeType::INTEGER;
1462  }
1463 
1464  /**
1465  * \brief Return type (ast::AstNodeType) of ast node as std::string
1466  *
1467  * Every node in the ast has a type defined in ast::AstNodeType.
1468  * This type name can be returned as a std::string for printing
1469  * node to text/json form.
1470  *
1471  * \return name of the node type as a string i.e. "Integer"
1472  *
1473  * \sa Ast::get_node_name
1474  */
1475  std::string get_node_type_name() const noexcept override {
1476  return "Integer";
1477  }
1478 
1479 
1480  /**
1481  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1482  */
1483  std::shared_ptr<Ast> get_shared_ptr() override {
1484  return std::static_pointer_cast<Integer>(shared_from_this());
1485  }
1486 
1487  /**
1488  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1489  */
1490  std::shared_ptr<const Ast> get_shared_ptr() const override {
1491  return std::static_pointer_cast<const Integer>(shared_from_this());
1492  }
1493 
1494  /**
1495  * \brief Return associated token for the current ast node
1496  *
1497  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
1498  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
1499  * nullptr to store in the nmodl::symtab::SymbolTable.
1500  *
1501  * \return pointer to token if exist otherwise nullptr
1502  */
1503  const ModToken* get_token() const noexcept override {
1504  return token.get();
1505  }
1506 
1507 
1508 
1509 
1510 
1511 
1512 
1513 
1514  /**
1515  * \brief Getter for member variable \ref Integer.value
1516  */
1517  int get_value() const noexcept {
1518  return value;
1519  }
1520 
1521 
1522 
1523 
1524 
1525 
1526 
1527  /**
1528  * \brief Getter for member variable \ref Integer.macro
1529  */
1530  const std::shared_ptr<Name>& get_macro() const noexcept {
1531  return macro;
1532  }
1533 
1534 
1535 
1536  /// \}
1537 
1538  /// \name Setters
1539  /// \{
1540 
1541 
1542  /**
1543  * \brief Set token for the current ast node
1544  */
1545  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
1546 
1547 
1548  /**
1549  * \brief Set new value to the current ast node
1550  * \sa Integer::eval
1551  */
1552  void set(int _value) {
1553  value = _value;
1554  }
1555 
1556 
1557  /**
1558  * \brief Setter for member variable \ref Integer.value
1559  */
1560  void set_value(int value);
1561 
1562 
1563  /**
1564  * \brief Setter for member variable \ref Integer.macro (rvalue reference)
1565  */
1566  void set_macro(std::shared_ptr<Name>&& macro);
1567 
1568  /**
1569  * \brief Setter for member variable \ref Integer.macro
1570  */
1571  void set_macro(const std::shared_ptr<Name>& macro);
1572 
1573 
1574  /// \}
1575 
1576  /// \name Visitor
1577  /// \{
1578 
1579  /**
1580  * \brief visit children i.e. member variables of current node using provided visitor
1581  *
1582  * Different nodes in the AST have different members (i.e. children). This method
1583  * recursively visits children using provided visitor.
1584  *
1585  * \param v Concrete visitor that will be used to recursively visit children
1586  *
1587  * \sa Ast::visit_children for example.
1588  */
1589  void visit_children(visitor::Visitor& v) override;
1590 
1591  /**
1592  * \brief visit children i.e. member variables of current node using provided visitor
1593  *
1594  * Different nodes in the AST have different members (i.e. children). This method
1595  * recursively visits children using provided visitor.
1596  *
1597  * \param v Concrete constant visitor that will be used to recursively visit children
1598  *
1599  * \sa Ast::visit_children for example.
1600  */
1601  void visit_children(visitor::ConstVisitor& v) const override;
1602 
1603  /**
1604  * \brief accept (or visit) the current AST node using provided visitor
1605  *
1606  * Instead of visiting children of AST node, like Ast::visit_children,
1607  * accept allows to visit the current node itself using provided concrete
1608  * visitor.
1609  *
1610  * \param v Concrete visitor that will be used to recursively visit node
1611  *
1612  * \sa Ast::accept for example.
1613  */
1614  void accept(visitor::Visitor& v) override;
1615 
1616  /**
1617  * \copydoc accept(visitor::Visitor&)
1618  */
1619  void accept(visitor::ConstVisitor& v) const override;
1620 
1621  /// \}
1622 
1623  /**
1624  * \brief Negate the value of current ast node
1625  *
1626  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1627  * `-` is encountered, the corresponding value of ast node needs to be
1628  * multiplied by `-1` for ast::Number node types.
1629  */
1630  void negate() override {
1631  value = -value;
1632  }
1633 
1634  /**
1635  * \brief Return value of the current ast node as double
1636  */
1637  double to_double() override {
1638  return value;
1639  }
1640 
1641  /**
1642  * \brief Return value of the ast node
1643  *
1644  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1645  * to their literal values. This method is used to access underlying
1646  * literal value.
1647  *
1648  * \sa Integer::set
1649  */
1650  int eval() const {
1651  return value;
1652  }
1653 
1654  private:
1655  /**
1656  * \brief Set this object as parent for all the children
1657  *
1658  * This should be called in every object (with children) constructor
1659  * to set parents. Since it is called only in the constructors it
1660  * should not be virtual to avoid ambiguities (issue #295).
1661  */
1662  void set_parent_in_children();
1663 };
1664 
1665 /** @} */ // end of ast_class
1666 
1667 
1668 } // namespace ast
1669 } // namespace nmodl
1670 #endif // !NMODL_AST_INTEGER_HPP
1671 #ifndef NMODL_AST_FLOAT_HPP
1672 #define NMODL_AST_FLOAT_HPP
1673 
1674 
1675 namespace nmodl {
1676 namespace ast {
1677 
1678 /**
1679  * @addtogroup ast_class
1680  * @ingroup ast
1681  * @{
1682  */
1683 
1684 /**
1685  * \brief Represents a float variable
1686  *
1687  * Single precision float value in the mod file can be represented by ast::Float.
1688  *
1689  * \note Currently every float variable in the NMODL is stored as ast::Double and hence
1690  * this type is note used. This will be changed soon for variables like ast::ParamAssign.
1691  *
1692  * \sa ast::Integer ast::Double
1693  *
1694 */
1695 class Float : public Number {
1696  private:
1697  /// Value of float
1698  std::string value;
1699  /// token with location information
1700  std::shared_ptr<ModToken> token;
1701 
1702  public:
1703 
1704  /// \name Ctor & dtor
1705  /// \{
1706 
1707  explicit Float(const std::string& value);
1708  Float(const Float& obj);
1709 
1710 
1711  virtual ~Float() = default;
1712 
1713  /// \}
1714 
1715 
1716 
1717 
1718 
1719 
1720  /**
1721  * \brief Check if the ast node is an instance of ast::Float
1722  * \return true as object is of type ast::Float
1723  */
1724  bool is_float () const noexcept override {
1725  return true;
1726  }
1727 
1728  /**
1729  * \brief Return a copy of the current node
1730  *
1731  * Recursively make a new copy/clone of the current node including
1732  * all members and return a pointer to the node. This is used for
1733  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1734  * ast.
1735  *
1736  * @return pointer to the clone/copy of the current node
1737  */
1738  Float* clone() const override {
1739  return new Float(*this);
1740  }
1741 
1742  /// \name Getters
1743  /// \{
1744 
1745  /**
1746  * \brief Return type (ast::AstNodeType) of ast node
1747  *
1748  * Every node in the ast has a type defined in ast::AstNodeType and this
1749  * function is used to retrieve the same.
1750  *
1751  * \return ast node type i.e. ast::AstNodeType::FLOAT
1752  *
1753  * \sa Ast::get_node_type_name
1754  */
1755  AstNodeType get_node_type() const noexcept override {
1756  return AstNodeType::FLOAT;
1757  }
1758 
1759  /**
1760  * \brief Return type (ast::AstNodeType) of ast node as std::string
1761  *
1762  * Every node in the ast has a type defined in ast::AstNodeType.
1763  * This type name can be returned as a std::string for printing
1764  * node to text/json form.
1765  *
1766  * \return name of the node type as a string i.e. "Float"
1767  *
1768  * \sa Ast::get_node_name
1769  */
1770  std::string get_node_type_name() const noexcept override {
1771  return "Float";
1772  }
1773 
1774 
1775  /**
1776  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1777  */
1778  std::shared_ptr<Ast> get_shared_ptr() override {
1779  return std::static_pointer_cast<Float>(shared_from_this());
1780  }
1781 
1782  /**
1783  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1784  */
1785  std::shared_ptr<const Ast> get_shared_ptr() const override {
1786  return std::static_pointer_cast<const Float>(shared_from_this());
1787  }
1788 
1789  /**
1790  * \brief Return associated token for the current ast node
1791  *
1792  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
1793  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
1794  * nullptr to store in the nmodl::symtab::SymbolTable.
1795  *
1796  * \return pointer to token if exist otherwise nullptr
1797  */
1798  const ModToken* get_token() const noexcept override {
1799  return token.get();
1800  }
1801 
1802 
1803 
1804 
1805 
1806 
1807 
1808 
1809  /**
1810  * \brief Getter for member variable \ref Float.value
1811  */
1812  const std::string& get_value() const noexcept {
1813  return value;
1814  }
1815 
1816 
1817 
1818  /// \}
1819 
1820  /// \name Setters
1821  /// \{
1822 
1823 
1824  /**
1825  * \brief Set token for the current ast node
1826  */
1827  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
1828 
1829 
1830  /**
1831  * \brief Set new value to the current ast node
1832  * \sa Float::eval
1833  */
1834  void set(std::string _value) {
1835  value = _value;
1836  }
1837 
1838 
1839  /**
1840  * \brief Setter for member variable \ref Float.value
1841  */
1842  void set_value(std::string value);
1843 
1844 
1845  /// \}
1846 
1847  /// \name Visitor
1848  /// \{
1849 
1850  /**
1851  * \brief visit children i.e. member variables of current node using provided visitor
1852  *
1853  * Different nodes in the AST have different members (i.e. children). This method
1854  * recursively visits children using provided visitor.
1855  *
1856  * \param v Concrete visitor that will be used to recursively visit children
1857  *
1858  * \sa Ast::visit_children for example.
1859  */
1860  void visit_children(visitor::Visitor& v) override;
1861 
1862  /**
1863  * \brief visit children i.e. member variables of current node using provided visitor
1864  *
1865  * Different nodes in the AST have different members (i.e. children). This method
1866  * recursively visits children using provided visitor.
1867  *
1868  * \param v Concrete constant visitor that will be used to recursively visit children
1869  *
1870  * \sa Ast::visit_children for example.
1871  */
1872  void visit_children(visitor::ConstVisitor& v) const override;
1873 
1874  /**
1875  * \brief accept (or visit) the current AST node using provided visitor
1876  *
1877  * Instead of visiting children of AST node, like Ast::visit_children,
1878  * accept allows to visit the current node itself using provided concrete
1879  * visitor.
1880  *
1881  * \param v Concrete visitor that will be used to recursively visit node
1882  *
1883  * \sa Ast::accept for example.
1884  */
1885  void accept(visitor::Visitor& v) override;
1886 
1887  /**
1888  * \copydoc accept(visitor::Visitor&)
1889  */
1890  void accept(visitor::ConstVisitor& v) const override;
1891 
1892  /// \}
1893 
1894  /**
1895  * \brief Negate the value of current ast node
1896  *
1897  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1898  * `-` is encountered, the corresponding value of ast node needs to be
1899  * multiplied by `-1` for ast::Number node types.
1900  */
1901  void negate() override {
1902  value = value.insert (0, 1, '-');
1903  }
1904 
1905  /**
1906  * \brief Return value of the current ast node as double
1907  */
1908  double to_double() override {
1909  return std::stod(value);
1910  }
1911 
1912  /**
1913  * \brief Return value of the ast node
1914  *
1915  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1916  * to their literal values. This method is used to access underlying
1917  * literal value.
1918  *
1919  * \sa Float::set
1920  */
1921  std::string eval() const {
1922  return value;
1923  }
1924 
1925  private:
1926  /**
1927  * \brief Set this object as parent for all the children
1928  *
1929  * This should be called in every object (with children) constructor
1930  * to set parents. Since it is called only in the constructors it
1931  * should not be virtual to avoid ambiguities (issue #295).
1932  */
1933  void set_parent_in_children();
1934 };
1935 
1936 /** @} */ // end of ast_class
1937 
1938 
1939 } // namespace ast
1940 } // namespace nmodl
1941 #endif // !NMODL_AST_FLOAT_HPP
1942 #ifndef NMODL_AST_DOUBLE_HPP
1943 #define NMODL_AST_DOUBLE_HPP
1944 
1945 
1946 namespace nmodl {
1947 namespace ast {
1948 
1949 /**
1950  * @addtogroup ast_class
1951  * @ingroup ast
1952  * @{
1953  */
1954 
1955 /**
1956  * \brief Represents a double variable
1957  *
1958  * %Double precision float value in the mod file is represented by ast::Double.
1959  * For example, float literals like `0.1` in the mod file are parsed as double
1960  * and stored using ast::Double::value :
1961  *
1962  * \code{.mod}
1963  * PROCEDURE foo() {
1964  * LOCAL x
1965  * x = 0.1 + tau
1966  * }
1967  * \endcode
1968  *
1969  * Note that the variables are not classified ast integer or float in the AST. The
1970  * decision about variable types is done by code generation backends.
1971  *
1972  * \sa ast::Integer ast::Float
1973  *
1974 */
1975 class Double : public Number {
1976  private:
1977  /// Value of double
1978  std::string value;
1979  /// token with location information
1980  std::shared_ptr<ModToken> token;
1981 
1982  public:
1983 
1984  /// \name Ctor & dtor
1985  /// \{
1986 
1987  explicit Double(const std::string& value);
1988  Double(const Double& obj);
1989 
1990  Double() = default;
1991 
1992  virtual ~Double() = default;
1993 
1994  /// \}
1995 
1996 
1997 
1998 
1999 
2000 
2001  /**
2002  * \brief Check if the ast node is an instance of ast::Double
2003  * \return true as object is of type ast::Double
2004  */
2005  bool is_double () const noexcept override {
2006  return true;
2007  }
2008 
2009  /**
2010  * \brief Return a copy of the current node
2011  *
2012  * Recursively make a new copy/clone of the current node including
2013  * all members and return a pointer to the node. This is used for
2014  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2015  * ast.
2016  *
2017  * @return pointer to the clone/copy of the current node
2018  */
2019  Double* clone() const override {
2020  return new Double(*this);
2021  }
2022 
2023  /// \name Getters
2024  /// \{
2025 
2026  /**
2027  * \brief Return type (ast::AstNodeType) of ast node
2028  *
2029  * Every node in the ast has a type defined in ast::AstNodeType and this
2030  * function is used to retrieve the same.
2031  *
2032  * \return ast node type i.e. ast::AstNodeType::DOUBLE
2033  *
2034  * \sa Ast::get_node_type_name
2035  */
2036  AstNodeType get_node_type() const noexcept override {
2037  return AstNodeType::DOUBLE;
2038  }
2039 
2040  /**
2041  * \brief Return type (ast::AstNodeType) of ast node as std::string
2042  *
2043  * Every node in the ast has a type defined in ast::AstNodeType.
2044  * This type name can be returned as a std::string for printing
2045  * node to text/json form.
2046  *
2047  * \return name of the node type as a string i.e. "Double"
2048  *
2049  * \sa Ast::get_node_name
2050  */
2051  std::string get_node_type_name() const noexcept override {
2052  return "Double";
2053  }
2054 
2055 
2056  /**
2057  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2058  */
2059  std::shared_ptr<Ast> get_shared_ptr() override {
2060  return std::static_pointer_cast<Double>(shared_from_this());
2061  }
2062 
2063  /**
2064  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2065  */
2066  std::shared_ptr<const Ast> get_shared_ptr() const override {
2067  return std::static_pointer_cast<const Double>(shared_from_this());
2068  }
2069 
2070  /**
2071  * \brief Return associated token for the current ast node
2072  *
2073  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
2074  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
2075  * nullptr to store in the nmodl::symtab::SymbolTable.
2076  *
2077  * \return pointer to token if exist otherwise nullptr
2078  */
2079  const ModToken* get_token() const noexcept override {
2080  return token.get();
2081  }
2082 
2083 
2084 
2085 
2086 
2087 
2088 
2089 
2090  /**
2091  * \brief Getter for member variable \ref Double.value
2092  */
2093  const std::string& get_value() const noexcept {
2094  return value;
2095  }
2096 
2097 
2098 
2099  /// \}
2100 
2101  /// \name Setters
2102  /// \{
2103 
2104 
2105  /**
2106  * \brief Set token for the current ast node
2107  */
2108  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
2109 
2110 
2111  /**
2112  * \brief Set new value to the current ast node
2113  * \sa Double::eval
2114  */
2115  void set(std::string _value) {
2116  value = _value;
2117  }
2118 
2119 
2120  /**
2121  * \brief Setter for member variable \ref Double.value
2122  */
2123  void set_value(std::string value);
2124 
2125 
2126  /// \}
2127 
2128  /// \name Visitor
2129  /// \{
2130 
2131  /**
2132  * \brief visit children i.e. member variables of current node using provided visitor
2133  *
2134  * Different nodes in the AST have different members (i.e. children). This method
2135  * recursively visits children using provided visitor.
2136  *
2137  * \param v Concrete visitor that will be used to recursively visit children
2138  *
2139  * \sa Ast::visit_children for example.
2140  */
2141  void visit_children(visitor::Visitor& v) override;
2142 
2143  /**
2144  * \brief visit children i.e. member variables of current node using provided visitor
2145  *
2146  * Different nodes in the AST have different members (i.e. children). This method
2147  * recursively visits children using provided visitor.
2148  *
2149  * \param v Concrete constant visitor that will be used to recursively visit children
2150  *
2151  * \sa Ast::visit_children for example.
2152  */
2153  void visit_children(visitor::ConstVisitor& v) const override;
2154 
2155  /**
2156  * \brief accept (or visit) the current AST node using provided visitor
2157  *
2158  * Instead of visiting children of AST node, like Ast::visit_children,
2159  * accept allows to visit the current node itself using provided concrete
2160  * visitor.
2161  *
2162  * \param v Concrete visitor that will be used to recursively visit node
2163  *
2164  * \sa Ast::accept for example.
2165  */
2166  void accept(visitor::Visitor& v) override;
2167 
2168  /**
2169  * \copydoc accept(visitor::Visitor&)
2170  */
2171  void accept(visitor::ConstVisitor& v) const override;
2172 
2173  /// \}
2174 
2175  /**
2176  * \brief Negate the value of current ast node
2177  *
2178  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
2179  * `-` is encountered, the corresponding value of ast node needs to be
2180  * multiplied by `-1` for ast::Number node types.
2181  */
2182  void negate() override {
2183  value = value.insert (0, 1, '-');
2184  }
2185 
2186  /**
2187  * \brief Return value of the current ast node as double
2188  */
2189  double to_double() override {
2190  return std::stod(value);
2191  }
2192 
2193  /**
2194  * \brief Return value of the ast node
2195  *
2196  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
2197  * to their literal values. This method is used to access underlying
2198  * literal value.
2199  *
2200  * \sa Double::set
2201  */
2202  std::string eval() const {
2203  return value;
2204  }
2205 
2206  private:
2207  /**
2208  * \brief Set this object as parent for all the children
2209  *
2210  * This should be called in every object (with children) constructor
2211  * to set parents. Since it is called only in the constructors it
2212  * should not be virtual to avoid ambiguities (issue #295).
2213  */
2214  void set_parent_in_children();
2215 };
2216 
2217 /** @} */ // end of ast_class
2218 
2219 
2220 } // namespace ast
2221 } // namespace nmodl
2222 #endif // !NMODL_AST_DOUBLE_HPP
2223 #ifndef NMODL_AST_BOOLEAN_HPP
2224 #define NMODL_AST_BOOLEAN_HPP
2225 
2226 
2227 namespace nmodl {
2228 namespace ast {
2229 
2230 /**
2231  * @addtogroup ast_class
2232  * @ingroup ast
2233  * @{
2234  */
2235 
2236 /**
2237  * \brief Represents a boolean variable
2238  *
2239  * %Boolean values in the mod file can be represented by ast::Boolean.
2240  *
2241  * \note Currently this type is used as only flag in some of the AST nodes. Similar to ast::Float,
2242  * this type was introduced for data type specific code generation support in the future.
2243  *
2244 */
2245 class Boolean : public Number {
2246  private:
2247  /// Value of boolean
2248  int value;
2249  /// token with location information
2250  std::shared_ptr<ModToken> token;
2251 
2252  public:
2253 
2254  /// \name Ctor & dtor
2255  /// \{
2256 
2257  explicit Boolean(int value);
2258  Boolean(const Boolean& obj);
2259 
2260 
2261  virtual ~Boolean() = default;
2262 
2263  /// \}
2264 
2265 
2266 
2267 
2268 
2269 
2270  /**
2271  * \brief Check if the ast node is an instance of ast::Boolean
2272  * \return true as object is of type ast::Boolean
2273  */
2274  bool is_boolean () const noexcept override {
2275  return true;
2276  }
2277 
2278  /**
2279  * \brief Return a copy of the current node
2280  *
2281  * Recursively make a new copy/clone of the current node including
2282  * all members and return a pointer to the node. This is used for
2283  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2284  * ast.
2285  *
2286  * @return pointer to the clone/copy of the current node
2287  */
2288  Boolean* clone() const override {
2289  return new Boolean(*this);
2290  }
2291 
2292  /// \name Getters
2293  /// \{
2294 
2295  /**
2296  * \brief Return type (ast::AstNodeType) of ast node
2297  *
2298  * Every node in the ast has a type defined in ast::AstNodeType and this
2299  * function is used to retrieve the same.
2300  *
2301  * \return ast node type i.e. ast::AstNodeType::BOOLEAN
2302  *
2303  * \sa Ast::get_node_type_name
2304  */
2305  AstNodeType get_node_type() const noexcept override {
2306  return AstNodeType::BOOLEAN;
2307  }
2308 
2309  /**
2310  * \brief Return type (ast::AstNodeType) of ast node as std::string
2311  *
2312  * Every node in the ast has a type defined in ast::AstNodeType.
2313  * This type name can be returned as a std::string for printing
2314  * node to text/json form.
2315  *
2316  * \return name of the node type as a string i.e. "Boolean"
2317  *
2318  * \sa Ast::get_node_name
2319  */
2320  std::string get_node_type_name() const noexcept override {
2321  return "Boolean";
2322  }
2323 
2324 
2325  /**
2326  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2327  */
2328  std::shared_ptr<Ast> get_shared_ptr() override {
2329  return std::static_pointer_cast<Boolean>(shared_from_this());
2330  }
2331 
2332  /**
2333  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2334  */
2335  std::shared_ptr<const Ast> get_shared_ptr() const override {
2336  return std::static_pointer_cast<const Boolean>(shared_from_this());
2337  }
2338 
2339  /**
2340  * \brief Return associated token for the current ast node
2341  *
2342  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
2343  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
2344  * nullptr to store in the nmodl::symtab::SymbolTable.
2345  *
2346  * \return pointer to token if exist otherwise nullptr
2347  */
2348  const ModToken* get_token() const noexcept override {
2349  return token.get();
2350  }
2351 
2352 
2353 
2354 
2355 
2356 
2357 
2358 
2359  /**
2360  * \brief Getter for member variable \ref Boolean.value
2361  */
2362  int get_value() const noexcept {
2363  return value;
2364  }
2365 
2366 
2367 
2368  /// \}
2369 
2370  /// \name Setters
2371  /// \{
2372 
2373 
2374  /**
2375  * \brief Set token for the current ast node
2376  */
2377  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
2378 
2379 
2380  /**
2381  * \brief Set new value to the current ast node
2382  * \sa Boolean::eval
2383  */
2384  void set(bool _value) {
2385  value = _value;
2386  }
2387 
2388 
2389  /**
2390  * \brief Setter for member variable \ref Boolean.value
2391  */
2392  void set_value(int value);
2393 
2394 
2395  /// \}
2396 
2397  /// \name Visitor
2398  /// \{
2399 
2400  /**
2401  * \brief visit children i.e. member variables of current node using provided visitor
2402  *
2403  * Different nodes in the AST have different members (i.e. children). This method
2404  * recursively visits children using provided visitor.
2405  *
2406  * \param v Concrete visitor that will be used to recursively visit children
2407  *
2408  * \sa Ast::visit_children for example.
2409  */
2410  void visit_children(visitor::Visitor& v) override;
2411 
2412  /**
2413  * \brief visit children i.e. member variables of current node using provided visitor
2414  *
2415  * Different nodes in the AST have different members (i.e. children). This method
2416  * recursively visits children using provided visitor.
2417  *
2418  * \param v Concrete constant visitor that will be used to recursively visit children
2419  *
2420  * \sa Ast::visit_children for example.
2421  */
2422  void visit_children(visitor::ConstVisitor& v) const override;
2423 
2424  /**
2425  * \brief accept (or visit) the current AST node using provided visitor
2426  *
2427  * Instead of visiting children of AST node, like Ast::visit_children,
2428  * accept allows to visit the current node itself using provided concrete
2429  * visitor.
2430  *
2431  * \param v Concrete visitor that will be used to recursively visit node
2432  *
2433  * \sa Ast::accept for example.
2434  */
2435  void accept(visitor::Visitor& v) override;
2436 
2437  /**
2438  * \copydoc accept(visitor::Visitor&)
2439  */
2440  void accept(visitor::ConstVisitor& v) const override;
2441 
2442  /// \}
2443 
2444  /**
2445  * \brief Negate the value of current ast node
2446  *
2447  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
2448  * `-` is encountered, the corresponding value of ast node needs to be
2449  * multiplied by `-1` for ast::Number node types.
2450  */
2451  void negate() override {
2452  value = !value;
2453  }
2454 
2455  /**
2456  * \brief Return value of the current ast node as double
2457  */
2458  double to_double() override {
2459  return value;
2460  }
2461 
2462  /**
2463  * \brief Return value of the ast node
2464  *
2465  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
2466  * to their literal values. This method is used to access underlying
2467  * literal value.
2468  *
2469  * \sa Boolean::set
2470  */
2471  bool eval() const {
2472  return value;
2473  }
2474 
2475  private:
2476  /**
2477  * \brief Set this object as parent for all the children
2478  *
2479  * This should be called in every object (with children) constructor
2480  * to set parents. Since it is called only in the constructors it
2481  * should not be virtual to avoid ambiguities (issue #295).
2482  */
2483  void set_parent_in_children();
2484 };
2485 
2486 /** @} */ // end of ast_class
2487 
2488 
2489 } // namespace ast
2490 } // namespace nmodl
2491 #endif // !NMODL_AST_BOOLEAN_HPP
2492 #ifndef NMODL_AST_NAME_HPP
2493 #define NMODL_AST_NAME_HPP
2494 
2495 
2496 namespace nmodl {
2497 namespace ast {
2498 
2499 /**
2500  * @addtogroup ast_class
2501  * @ingroup ast
2502  * @{
2503  */
2504 
2505 /**
2506  * \brief Represents a name
2507  *
2508  * Whenever lexer encounters string variable, it returns a ast::Name
2509  * type. So, along with ast::Integer, ast::Double ast::String and ast::PrimeName,
2510  * ast::Name is one of the fundamental type in the AST. Many other variable types
2511  * (e.g. ast::GlobalVar, ast::RangeVar) have underlying value stored as ast::Name.
2512  *
2513  * \note This node should be able to use std::string as value type instead of ast::String
2514  *
2515 */
2516 class Name : public Identifier {
2517  private:
2518  /// Value of name
2519  std::shared_ptr<String> value;
2520  /// token with location information
2521  std::shared_ptr<ModToken> token;
2522 
2523  public:
2524 
2525  /// \name Ctor & dtor
2526  /// \{
2527 
2528  explicit Name(String* value);
2529  explicit Name(const std::shared_ptr<String>& value);
2530  Name(const Name& obj);
2531 
2532  Name() = default;
2533 
2534  virtual ~Name() = default;
2535 
2536  /// \}
2537 
2538 
2539 
2540 
2541 
2542 
2543  /**
2544  * \brief Check if the ast node is an instance of ast::Name
2545  * \return true as object is of type ast::Name
2546  */
2547  bool is_name () const noexcept override {
2548  return true;
2549  }
2550 
2551  /**
2552  * \brief Return a copy of the current node
2553  *
2554  * Recursively make a new copy/clone of the current node including
2555  * all members and return a pointer to the node. This is used for
2556  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2557  * ast.
2558  *
2559  * @return pointer to the clone/copy of the current node
2560  */
2561  Name* clone() const override {
2562  return new Name(*this);
2563  }
2564 
2565  /// \name Getters
2566  /// \{
2567 
2568  /**
2569  * \brief Return type (ast::AstNodeType) of ast node
2570  *
2571  * Every node in the ast has a type defined in ast::AstNodeType and this
2572  * function is used to retrieve the same.
2573  *
2574  * \return ast node type i.e. ast::AstNodeType::NAME
2575  *
2576  * \sa Ast::get_node_type_name
2577  */
2578  AstNodeType get_node_type() const noexcept override {
2579  return AstNodeType::NAME;
2580  }
2581 
2582  /**
2583  * \brief Return type (ast::AstNodeType) of ast node as std::string
2584  *
2585  * Every node in the ast has a type defined in ast::AstNodeType.
2586  * This type name can be returned as a std::string for printing
2587  * node to text/json form.
2588  *
2589  * \return name of the node type as a string i.e. "Name"
2590  *
2591  * \sa Ast::get_node_name
2592  */
2593  std::string get_node_type_name() const noexcept override {
2594  return "Name";
2595  }
2596 
2597 
2598  /**
2599  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2600  */
2601  std::shared_ptr<Ast> get_shared_ptr() override {
2602  return std::static_pointer_cast<Name>(shared_from_this());
2603  }
2604 
2605  /**
2606  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2607  */
2608  std::shared_ptr<const Ast> get_shared_ptr() const override {
2609  return std::static_pointer_cast<const Name>(shared_from_this());
2610  }
2611 
2612  /**
2613  * \brief Return associated token for the current ast node
2614  *
2615  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
2616  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
2617  * nullptr to store in the nmodl::symtab::SymbolTable.
2618  *
2619  * \return pointer to token if exist otherwise nullptr
2620  */
2621  const ModToken* get_token() const noexcept override {
2622  return token.get();
2623  }
2624 
2625 
2626 
2627 
2628 
2629 
2630 /**
2631  * \brief Return name of the node
2632  *
2633  * Some ast nodes have a member marked designated as node name. For example,
2634  * in case of this ast::String has value designated as a
2635  * node name.
2636  *
2637  * @return name of the node as std::string
2638  *
2639  * \sa Ast::get_node_type_name
2640  */
2641 std::string get_node_name() const override;
2642 
2643 
2644  /**
2645  * \brief Getter for member variable \ref Name.value
2646  */
2647  const std::shared_ptr<String>& get_value() const noexcept {
2648  return value;
2649  }
2650 
2651 
2652 
2653  /// \}
2654 
2655  /// \name Setters
2656  /// \{
2657 
2658  /**
2659  * \brief Set name for the current ast node
2660  *
2661  * Some ast nodes have a member marked designated as node name (e.g. nodes
2662  * derived from ast::Identifier). This method is used to set new name for those
2663  * nodes. This useful for passes like nmodl::visitor::RenameVisitor.
2664  *
2665  * \sa Ast::get_node_type_name Ast::get_node_name
2666  */
2667  void set_name(const std::string& name) override;
2668 
2669  /**
2670  * \brief Set token for the current ast node
2671  */
2672  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
2673 
2674 
2675 
2676 
2677  /**
2678  * \brief Setter for member variable \ref Name.value (rvalue reference)
2679  */
2680  void set_value(std::shared_ptr<String>&& value);
2681 
2682  /**
2683  * \brief Setter for member variable \ref Name.value
2684  */
2685  void set_value(const std::shared_ptr<String>& value);
2686 
2687 
2688  /// \}
2689 
2690  /// \name Visitor
2691  /// \{
2692 
2693  /**
2694  * \brief visit children i.e. member variables of current node using provided visitor
2695  *
2696  * Different nodes in the AST have different members (i.e. children). This method
2697  * recursively visits children using provided visitor.
2698  *
2699  * \param v Concrete visitor that will be used to recursively visit children
2700  *
2701  * \sa Ast::visit_children for example.
2702  */
2703  void visit_children(visitor::Visitor& v) override;
2704 
2705  /**
2706  * \brief visit children i.e. member variables of current node using provided visitor
2707  *
2708  * Different nodes in the AST have different members (i.e. children). This method
2709  * recursively visits children using provided visitor.
2710  *
2711  * \param v Concrete constant visitor that will be used to recursively visit children
2712  *
2713  * \sa Ast::visit_children for example.
2714  */
2715  void visit_children(visitor::ConstVisitor& v) const override;
2716 
2717  /**
2718  * \brief accept (or visit) the current AST node using provided visitor
2719  *
2720  * Instead of visiting children of AST node, like Ast::visit_children,
2721  * accept allows to visit the current node itself using provided concrete
2722  * visitor.
2723  *
2724  * \param v Concrete visitor that will be used to recursively visit node
2725  *
2726  * \sa Ast::accept for example.
2727  */
2728  void accept(visitor::Visitor& v) override;
2729 
2730  /**
2731  * \copydoc accept(visitor::Visitor&)
2732  */
2733  void accept(visitor::ConstVisitor& v) const override;
2734 
2735  /// \}
2736 
2737 
2738 
2739  private:
2740  /**
2741  * \brief Set this object as parent for all the children
2742  *
2743  * This should be called in every object (with children) constructor
2744  * to set parents. Since it is called only in the constructors it
2745  * should not be virtual to avoid ambiguities (issue #295).
2746  */
2747  void set_parent_in_children();
2748 };
2749 
2750 /** @} */ // end of ast_class
2751 
2752 
2753 } // namespace ast
2754 } // namespace nmodl
2755 #endif // !NMODL_AST_NAME_HPP
2756 #ifndef NMODL_AST_PRIME_NAME_HPP
2757 #define NMODL_AST_PRIME_NAME_HPP
2758 
2759 
2760 namespace nmodl {
2761 namespace ast {
2762 
2763 /**
2764  * @addtogroup ast_class
2765  * @ingroup ast
2766  * @{
2767  */
2768 
2769 /**
2770  * \brief Represents a prime variable (for ODE)
2771  *
2772  * In case of ODE specification, all state variables appearing on LHS
2773  * with \` as suffix are parsed by lexer as ast::PrimeName. For example,
2774  * in below NMODL construct, m\` is stored as ast::PrimeName with `m` as a
2775  * ast::PrimeName::value and `1` as an ast::PrimeName::order.
2776  *
2777  * \code
2778  * DERIVATIVE states {
2779  * m` = m + h
2780  * }
2781  * \endcode
2782  *
2783 */
2784 class PrimeName : public Identifier {
2785  private:
2786  /// Name of prime variable
2787  std::shared_ptr<String> value;
2788  /// order of ODE
2789  std::shared_ptr<Integer> order;
2790  /// token with location information
2791  std::shared_ptr<ModToken> token;
2792 
2793  public:
2794 
2795  /// \name Ctor & dtor
2796  /// \{
2797 
2798  explicit PrimeName(String* value, Integer* order);
2799  explicit PrimeName(const std::shared_ptr<String>& value, const std::shared_ptr<Integer>& order);
2800  PrimeName(const PrimeName& obj);
2801 
2802  PrimeName() = default;
2803 
2804  virtual ~PrimeName() = default;
2805 
2806  /// \}
2807 
2808 
2809 
2810 
2811 
2812 
2813  /**
2814  * \brief Check if the ast node is an instance of ast::PrimeName
2815  * \return true as object is of type ast::PrimeName
2816  */
2817  bool is_prime_name () const noexcept override {
2818  return true;
2819  }
2820 
2821  /**
2822  * \brief Return a copy of the current node
2823  *
2824  * Recursively make a new copy/clone of the current node including
2825  * all members and return a pointer to the node. This is used for
2826  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2827  * ast.
2828  *
2829  * @return pointer to the clone/copy of the current node
2830  */
2831  PrimeName* clone() const override {
2832  return new PrimeName(*this);
2833  }
2834 
2835  /// \name Getters
2836  /// \{
2837 
2838  /**
2839  * \brief Return type (ast::AstNodeType) of ast node
2840  *
2841  * Every node in the ast has a type defined in ast::AstNodeType and this
2842  * function is used to retrieve the same.
2843  *
2844  * \return ast node type i.e. ast::AstNodeType::PRIME_NAME
2845  *
2846  * \sa Ast::get_node_type_name
2847  */
2848  AstNodeType get_node_type() const noexcept override {
2849  return AstNodeType::PRIME_NAME;
2850  }
2851 
2852  /**
2853  * \brief Return type (ast::AstNodeType) of ast node as std::string
2854  *
2855  * Every node in the ast has a type defined in ast::AstNodeType.
2856  * This type name can be returned as a std::string for printing
2857  * node to text/json form.
2858  *
2859  * \return name of the node type as a string i.e. "PrimeName"
2860  *
2861  * \sa Ast::get_node_name
2862  */
2863  std::string get_node_type_name() const noexcept override {
2864  return "PrimeName";
2865  }
2866 
2867 
2868  /**
2869  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2870  */
2871  std::shared_ptr<Ast> get_shared_ptr() override {
2872  return std::static_pointer_cast<PrimeName>(shared_from_this());
2873  }
2874 
2875  /**
2876  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2877  */
2878  std::shared_ptr<const Ast> get_shared_ptr() const override {
2879  return std::static_pointer_cast<const PrimeName>(shared_from_this());
2880  }
2881 
2882  /**
2883  * \brief Return associated token for the current ast node
2884  *
2885  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
2886  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
2887  * nullptr to store in the nmodl::symtab::SymbolTable.
2888  *
2889  * \return pointer to token if exist otherwise nullptr
2890  */
2891  const ModToken* get_token() const noexcept override {
2892  return token.get();
2893  }
2894 
2895 
2896 
2897 
2898 
2899 
2900 /**
2901  * \brief Return name of the node
2902  *
2903  * Some ast nodes have a member marked designated as node name. For example,
2904  * in case of this ast::String has value designated as a
2905  * node name.
2906  *
2907  * @return name of the node as std::string
2908  *
2909  * \sa Ast::get_node_type_name
2910  */
2911 std::string get_node_name() const override;
2912 
2913 
2914  /**
2915  * \brief Getter for member variable \ref PrimeName.value
2916  */
2917  const std::shared_ptr<String>& get_value() const noexcept {
2918  return value;
2919  }
2920 
2921 
2922 
2923 
2924 
2925 
2926 
2927  /**
2928  * \brief Getter for member variable \ref PrimeName.order
2929  */
2930  const std::shared_ptr<Integer>& get_order() const noexcept {
2931  return order;
2932  }
2933 
2934 
2935 
2936  /// \}
2937 
2938  /// \name Setters
2939  /// \{
2940 
2941 
2942  /**
2943  * \brief Set token for the current ast node
2944  */
2945  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
2946 
2947 
2948 
2949 
2950  /**
2951  * \brief Setter for member variable \ref PrimeName.value (rvalue reference)
2952  */
2953  void set_value(std::shared_ptr<String>&& value);
2954 
2955  /**
2956  * \brief Setter for member variable \ref PrimeName.value
2957  */
2958  void set_value(const std::shared_ptr<String>& value);
2959 
2960 
2961  /**
2962  * \brief Setter for member variable \ref PrimeName.order (rvalue reference)
2963  */
2964  void set_order(std::shared_ptr<Integer>&& order);
2965 
2966  /**
2967  * \brief Setter for member variable \ref PrimeName.order
2968  */
2969  void set_order(const std::shared_ptr<Integer>& order);
2970 
2971 
2972  /// \}
2973 
2974  /// \name Visitor
2975  /// \{
2976 
2977  /**
2978  * \brief visit children i.e. member variables of current node using provided visitor
2979  *
2980  * Different nodes in the AST have different members (i.e. children). This method
2981  * recursively visits children using provided visitor.
2982  *
2983  * \param v Concrete visitor that will be used to recursively visit children
2984  *
2985  * \sa Ast::visit_children for example.
2986  */
2987  void visit_children(visitor::Visitor& v) override;
2988 
2989  /**
2990  * \brief visit children i.e. member variables of current node using provided visitor
2991  *
2992  * Different nodes in the AST have different members (i.e. children). This method
2993  * recursively visits children using provided visitor.
2994  *
2995  * \param v Concrete constant visitor that will be used to recursively visit children
2996  *
2997  * \sa Ast::visit_children for example.
2998  */
2999  void visit_children(visitor::ConstVisitor& v) const override;
3000 
3001  /**
3002  * \brief accept (or visit) the current AST node using provided visitor
3003  *
3004  * Instead of visiting children of AST node, like Ast::visit_children,
3005  * accept allows to visit the current node itself using provided concrete
3006  * visitor.
3007  *
3008  * \param v Concrete visitor that will be used to recursively visit node
3009  *
3010  * \sa Ast::accept for example.
3011  */
3012  void accept(visitor::Visitor& v) override;
3013 
3014  /**
3015  * \copydoc accept(visitor::Visitor&)
3016  */
3017  void accept(visitor::ConstVisitor& v) const override;
3018 
3019  /// \}
3020 
3021 
3022 
3023  private:
3024  /**
3025  * \brief Set this object as parent for all the children
3026  *
3027  * This should be called in every object (with children) constructor
3028  * to set parents. Since it is called only in the constructors it
3029  * should not be virtual to avoid ambiguities (issue #295).
3030  */
3031  void set_parent_in_children();
3032 };
3033 
3034 /** @} */ // end of ast_class
3035 
3036 
3037 } // namespace ast
3038 } // namespace nmodl
3039 #endif // !NMODL_AST_PRIME_NAME_HPP
3040 #ifndef NMODL_AST_INDEXED_NAME_HPP
3041 #define NMODL_AST_INDEXED_NAME_HPP
3042 
3043 
3044 namespace nmodl {
3045 namespace ast {
3046 
3047 /**
3048  * @addtogroup ast_class
3049  * @ingroup ast
3050  * @{
3051  */
3052 
3053 /**
3054  * \brief Represents specific element of an array variable
3055  *
3056  * If variable is declared as an array or when array element is accessed,
3057  * it is stored in the ast as ast::IndexedName. For example, in below NMODL,
3058  * construct `m[4]` is stored as ast::IndexedName with `m` as ast::IndexedName::name
3059  * and `4` as ast::IndexedName::legth.
3060  *
3061  * \code
3062  * STATE {
3063  * m[4]
3064  * }
3065  * \endcode
3066  *
3067 */
3068 class IndexedName : public Identifier {
3069  private:
3070  /// Name of array variable
3071  std::shared_ptr<Identifier> name;
3072  /// legth of an array or index position
3073  std::shared_ptr<Expression> length;
3074  /// token with location information
3075  std::shared_ptr<ModToken> token;
3076 
3077  public:
3078 
3079  /// \name Ctor & dtor
3080  /// \{
3081 
3082  explicit IndexedName(Identifier* name, Expression* length);
3083  explicit IndexedName(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Expression>& length);
3084  IndexedName(const IndexedName& obj);
3085 
3086 
3087  virtual ~IndexedName() = default;
3088 
3089  /// \}
3090 
3091 
3092 
3093 
3094 
3095 
3096  /**
3097  * \brief Check if the ast node is an instance of ast::IndexedName
3098  * \return true as object is of type ast::IndexedName
3099  */
3100  bool is_indexed_name () const noexcept override {
3101  return true;
3102  }
3103 
3104  /**
3105  * \brief Return a copy of the current node
3106  *
3107  * Recursively make a new copy/clone of the current node including
3108  * all members and return a pointer to the node. This is used for
3109  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3110  * ast.
3111  *
3112  * @return pointer to the clone/copy of the current node
3113  */
3114  IndexedName* clone() const override {
3115  return new IndexedName(*this);
3116  }
3117 
3118  /// \name Getters
3119  /// \{
3120 
3121  /**
3122  * \brief Return type (ast::AstNodeType) of ast node
3123  *
3124  * Every node in the ast has a type defined in ast::AstNodeType and this
3125  * function is used to retrieve the same.
3126  *
3127  * \return ast node type i.e. ast::AstNodeType::INDEXED_NAME
3128  *
3129  * \sa Ast::get_node_type_name
3130  */
3131  AstNodeType get_node_type() const noexcept override {
3133  }
3134 
3135  /**
3136  * \brief Return type (ast::AstNodeType) of ast node as std::string
3137  *
3138  * Every node in the ast has a type defined in ast::AstNodeType.
3139  * This type name can be returned as a std::string for printing
3140  * node to text/json form.
3141  *
3142  * \return name of the node type as a string i.e. "IndexedName"
3143  *
3144  * \sa Ast::get_node_name
3145  */
3146  std::string get_node_type_name() const noexcept override {
3147  return "IndexedName";
3148  }
3149 
3150 
3151  /**
3152  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3153  */
3154  std::shared_ptr<Ast> get_shared_ptr() override {
3155  return std::static_pointer_cast<IndexedName>(shared_from_this());
3156  }
3157 
3158  /**
3159  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3160  */
3161  std::shared_ptr<const Ast> get_shared_ptr() const override {
3162  return std::static_pointer_cast<const IndexedName>(shared_from_this());
3163  }
3164 
3165  /**
3166  * \brief Return associated token for the current ast node
3167  *
3168  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
3169  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
3170  * nullptr to store in the nmodl::symtab::SymbolTable.
3171  *
3172  * \return pointer to token if exist otherwise nullptr
3173  */
3174  const ModToken* get_token() const noexcept override {
3175  return token.get();
3176  }
3177 
3178 
3179 
3180 
3181 
3182 
3183 /**
3184  * \brief Return name of the node
3185  *
3186  * Some ast nodes have a member marked designated as node name. For example,
3187  * in case of this ast::Identifier has name designated as a
3188  * node name.
3189  *
3190  * @return name of the node as std::string
3191  *
3192  * \sa Ast::get_node_type_name
3193  */
3194 std::string get_node_name() const override;
3195 
3196 
3197  /**
3198  * \brief Getter for member variable \ref IndexedName.name
3199  */
3200  const std::shared_ptr<Identifier>& get_name() const noexcept {
3201  return name;
3202  }
3203 
3204 
3205 
3206 
3207 
3208 
3209 
3210  /**
3211  * \brief Getter for member variable \ref IndexedName.length
3212  */
3213  const std::shared_ptr<Expression>& get_length() const noexcept {
3214  return length;
3215  }
3216 
3217 
3218 
3219  /// \}
3220 
3221  /// \name Setters
3222  /// \{
3223 
3224 
3225  /**
3226  * \brief Set token for the current ast node
3227  */
3228  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
3229 
3230 
3231 
3232 
3233  /**
3234  * \brief Setter for member variable \ref IndexedName.name (rvalue reference)
3235  */
3236  void set_name(std::shared_ptr<Identifier>&& name);
3237 
3238  /**
3239  * \brief Setter for member variable \ref IndexedName.name
3240  */
3241  void set_name(const std::shared_ptr<Identifier>& name);
3242 
3243 
3244  /**
3245  * \brief Setter for member variable \ref IndexedName.length (rvalue reference)
3246  */
3247  void set_length(std::shared_ptr<Expression>&& length);
3248 
3249  /**
3250  * \brief Setter for member variable \ref IndexedName.length
3251  */
3252  void set_length(const std::shared_ptr<Expression>& length);
3253 
3254 
3255  /// \}
3256 
3257  /// \name Visitor
3258  /// \{
3259 
3260  /**
3261  * \brief visit children i.e. member variables of current node using provided visitor
3262  *
3263  * Different nodes in the AST have different members (i.e. children). This method
3264  * recursively visits children using provided visitor.
3265  *
3266  * \param v Concrete visitor that will be used to recursively visit children
3267  *
3268  * \sa Ast::visit_children for example.
3269  */
3270  void visit_children(visitor::Visitor& v) override;
3271 
3272  /**
3273  * \brief visit children i.e. member variables of current node using provided visitor
3274  *
3275  * Different nodes in the AST have different members (i.e. children). This method
3276  * recursively visits children using provided visitor.
3277  *
3278  * \param v Concrete constant visitor that will be used to recursively visit children
3279  *
3280  * \sa Ast::visit_children for example.
3281  */
3282  void visit_children(visitor::ConstVisitor& v) const override;
3283 
3284  /**
3285  * \brief accept (or visit) the current AST node using provided visitor
3286  *
3287  * Instead of visiting children of AST node, like Ast::visit_children,
3288  * accept allows to visit the current node itself using provided concrete
3289  * visitor.
3290  *
3291  * \param v Concrete visitor that will be used to recursively visit node
3292  *
3293  * \sa Ast::accept for example.
3294  */
3295  void accept(visitor::Visitor& v) override;
3296 
3297  /**
3298  * \copydoc accept(visitor::Visitor&)
3299  */
3300  void accept(visitor::ConstVisitor& v) const override;
3301 
3302  /// \}
3303 
3304 
3305 
3306  private:
3307  /**
3308  * \brief Set this object as parent for all the children
3309  *
3310  * This should be called in every object (with children) constructor
3311  * to set parents. Since it is called only in the constructors it
3312  * should not be virtual to avoid ambiguities (issue #295).
3313  */
3314  void set_parent_in_children();
3315 };
3316 
3317 /** @} */ // end of ast_class
3318 
3319 
3320 } // namespace ast
3321 } // namespace nmodl
3322 #endif // !NMODL_AST_INDEXED_NAME_HPP
3323 #ifndef NMODL_AST_VAR_NAME_HPP
3324 #define NMODL_AST_VAR_NAME_HPP
3325 
3326 
3327 namespace nmodl {
3328 namespace ast {
3329 
3330 /**
3331  * @addtogroup ast_class
3332  * @ingroup ast
3333  * @{
3334  */
3335 
3336 /**
3337  * \brief Represents a variable
3338  *
3339  * This type was introduced to store variables of different types like
3340  * ast::Name or ast::IndexedName in the AST.
3341  *
3342  * \note With ast::Identifier as top level base class, this type can be
3343  * removed in the future refactoring.
3344  *
3345 */
3346 class VarName : public Identifier {
3347  private:
3348  /// Name of variable
3349  std::shared_ptr<Identifier> name;
3350  /// Value specified with `@`
3351  std::shared_ptr<Integer> at;
3352  /// index value in case of array
3353  std::shared_ptr<Expression> index;
3354  /// token with location information
3355  std::shared_ptr<ModToken> token;
3356 
3357  public:
3358 
3359  /// \name Ctor & dtor
3360  /// \{
3361 
3362  explicit VarName(Identifier* name, Integer* at, Expression* index);
3363  explicit VarName(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Integer>& at, const std::shared_ptr<Expression>& index);
3364  VarName(const VarName& obj);
3365 
3366 
3367  virtual ~VarName() = default;
3368 
3369  /// \}
3370 
3371 
3372 
3373 
3374 
3375 
3376  /**
3377  * \brief Check if the ast node is an instance of ast::VarName
3378  * \return true as object is of type ast::VarName
3379  */
3380  bool is_var_name () const noexcept override {
3381  return true;
3382  }
3383 
3384  /**
3385  * \brief Return a copy of the current node
3386  *
3387  * Recursively make a new copy/clone of the current node including
3388  * all members and return a pointer to the node. This is used for
3389  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3390  * ast.
3391  *
3392  * @return pointer to the clone/copy of the current node
3393  */
3394  VarName* clone() const override {
3395  return new VarName(*this);
3396  }
3397 
3398  /// \name Getters
3399  /// \{
3400 
3401  /**
3402  * \brief Return type (ast::AstNodeType) of ast node
3403  *
3404  * Every node in the ast has a type defined in ast::AstNodeType and this
3405  * function is used to retrieve the same.
3406  *
3407  * \return ast node type i.e. ast::AstNodeType::VAR_NAME
3408  *
3409  * \sa Ast::get_node_type_name
3410  */
3411  AstNodeType get_node_type() const noexcept override {
3412  return AstNodeType::VAR_NAME;
3413  }
3414 
3415  /**
3416  * \brief Return type (ast::AstNodeType) of ast node as std::string
3417  *
3418  * Every node in the ast has a type defined in ast::AstNodeType.
3419  * This type name can be returned as a std::string for printing
3420  * node to text/json form.
3421  *
3422  * \return name of the node type as a string i.e. "VarName"
3423  *
3424  * \sa Ast::get_node_name
3425  */
3426  std::string get_node_type_name() const noexcept override {
3427  return "VarName";
3428  }
3429 
3430 
3431  /**
3432  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3433  */
3434  std::shared_ptr<Ast> get_shared_ptr() override {
3435  return std::static_pointer_cast<VarName>(shared_from_this());
3436  }
3437 
3438  /**
3439  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3440  */
3441  std::shared_ptr<const Ast> get_shared_ptr() const override {
3442  return std::static_pointer_cast<const VarName>(shared_from_this());
3443  }
3444 
3445  /**
3446  * \brief Return associated token for the current ast node
3447  *
3448  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
3449  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
3450  * nullptr to store in the nmodl::symtab::SymbolTable.
3451  *
3452  * \return pointer to token if exist otherwise nullptr
3453  */
3454  const ModToken* get_token() const noexcept override {
3455  return token.get();
3456  }
3457 
3458 
3459 
3460 
3461 
3462 
3463 /**
3464  * \brief Return name of the node
3465  *
3466  * Some ast nodes have a member marked designated as node name. For example,
3467  * in case of this ast::Identifier has name designated as a
3468  * node name.
3469  *
3470  * @return name of the node as std::string
3471  *
3472  * \sa Ast::get_node_type_name
3473  */
3474 std::string get_node_name() const override;
3475 
3476 
3477  /**
3478  * \brief Getter for member variable \ref VarName.name
3479  */
3480  const std::shared_ptr<Identifier>& get_name() const noexcept {
3481  return name;
3482  }
3483 
3484 
3485 
3486 
3487 
3488 
3489 
3490  /**
3491  * \brief Getter for member variable \ref VarName.at
3492  */
3493  const std::shared_ptr<Integer>& get_at() const noexcept {
3494  return at;
3495  }
3496 
3497 
3498 
3499 
3500 
3501 
3502 
3503  /**
3504  * \brief Getter for member variable \ref VarName.index
3505  */
3506  const std::shared_ptr<Expression>& get_index() const noexcept {
3507  return index;
3508  }
3509 
3510 
3511 
3512  /// \}
3513 
3514  /// \name Setters
3515  /// \{
3516 
3517 
3518  /**
3519  * \brief Set token for the current ast node
3520  */
3521  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
3522 
3523 
3524 
3525 
3526  /**
3527  * \brief Setter for member variable \ref VarName.name (rvalue reference)
3528  */
3529  void set_name(std::shared_ptr<Identifier>&& name);
3530 
3531  /**
3532  * \brief Setter for member variable \ref VarName.name
3533  */
3534  void set_name(const std::shared_ptr<Identifier>& name);
3535 
3536 
3537  /**
3538  * \brief Setter for member variable \ref VarName.at (rvalue reference)
3539  */
3540  void set_at(std::shared_ptr<Integer>&& at);
3541 
3542  /**
3543  * \brief Setter for member variable \ref VarName.at
3544  */
3545  void set_at(const std::shared_ptr<Integer>& at);
3546 
3547 
3548  /**
3549  * \brief Setter for member variable \ref VarName.index (rvalue reference)
3550  */
3551  void set_index(std::shared_ptr<Expression>&& index);
3552 
3553  /**
3554  * \brief Setter for member variable \ref VarName.index
3555  */
3556  void set_index(const std::shared_ptr<Expression>& index);
3557 
3558 
3559  /// \}
3560 
3561  /// \name Visitor
3562  /// \{
3563 
3564  /**
3565  * \brief visit children i.e. member variables of current node using provided visitor
3566  *
3567  * Different nodes in the AST have different members (i.e. children). This method
3568  * recursively visits children using provided visitor.
3569  *
3570  * \param v Concrete visitor that will be used to recursively visit children
3571  *
3572  * \sa Ast::visit_children for example.
3573  */
3574  void visit_children(visitor::Visitor& v) override;
3575 
3576  /**
3577  * \brief visit children i.e. member variables of current node using provided visitor
3578  *
3579  * Different nodes in the AST have different members (i.e. children). This method
3580  * recursively visits children using provided visitor.
3581  *
3582  * \param v Concrete constant visitor that will be used to recursively visit children
3583  *
3584  * \sa Ast::visit_children for example.
3585  */
3586  void visit_children(visitor::ConstVisitor& v) const override;
3587 
3588  /**
3589  * \brief accept (or visit) the current AST node using provided visitor
3590  *
3591  * Instead of visiting children of AST node, like Ast::visit_children,
3592  * accept allows to visit the current node itself using provided concrete
3593  * visitor.
3594  *
3595  * \param v Concrete visitor that will be used to recursively visit node
3596  *
3597  * \sa Ast::accept for example.
3598  */
3599  void accept(visitor::Visitor& v) override;
3600 
3601  /**
3602  * \copydoc accept(visitor::Visitor&)
3603  */
3604  void accept(visitor::ConstVisitor& v) const override;
3605 
3606  /// \}
3607 
3608 
3609 
3610  private:
3611  /**
3612  * \brief Set this object as parent for all the children
3613  *
3614  * This should be called in every object (with children) constructor
3615  * to set parents. Since it is called only in the constructors it
3616  * should not be virtual to avoid ambiguities (issue #295).
3617  */
3618  void set_parent_in_children();
3619 };
3620 
3621 /** @} */ // end of ast_class
3622 
3623 
3624 } // namespace ast
3625 } // namespace nmodl
3626 #endif // !NMODL_AST_VAR_NAME_HPP
3627 #ifndef NMODL_AST_ARGUMENT_HPP
3628 #define NMODL_AST_ARGUMENT_HPP
3629 
3630 
3631 namespace nmodl {
3632 namespace ast {
3633 
3634 /**
3635  * @addtogroup ast_class
3636  * @ingroup ast
3637  * @{
3638  */
3639 
3640 /**
3641  * \brief Represents an argument to functions and procedures
3642  *
3643  * In case of function definitions from different ast nodes like ast::FunctionBlock,
3644  * ast::ProcedureBlock, the arguments are store in the ast::Argument. For example,
3645  * in below NMODL construct, `weight` is stored as ast::Argument::name and `uS` is
3646  * stored as ast::Argument::unit:
3647  *
3648  * \code {.mod}
3649  * NET_RECEIVE(weight (uS)) {
3650  * g = g + weight
3651  * }
3652  * \endcode
3653  *
3654 */
3655 class Argument : public Identifier {
3656  private:
3657  /// Name of the argument
3658  std::shared_ptr<Identifier> name;
3659  /// Unit of the argument
3660  std::shared_ptr<Unit> unit;
3661  /// token with location information
3662  std::shared_ptr<ModToken> token;
3663 
3664  public:
3665 
3666  /// \name Ctor & dtor
3667  /// \{
3668 
3669  explicit Argument(Identifier* name, Unit* unit);
3670  explicit Argument(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Unit>& unit);
3671  Argument(const Argument& obj);
3672 
3673 
3674  virtual ~Argument() = default;
3675 
3676  /// \}
3677 
3678 
3679 
3680 
3681 
3682 
3683  /**
3684  * \brief Check if the ast node is an instance of ast::Argument
3685  * \return true as object is of type ast::Argument
3686  */
3687  bool is_argument () const noexcept override {
3688  return true;
3689  }
3690 
3691  /**
3692  * \brief Return a copy of the current node
3693  *
3694  * Recursively make a new copy/clone of the current node including
3695  * all members and return a pointer to the node. This is used for
3696  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3697  * ast.
3698  *
3699  * @return pointer to the clone/copy of the current node
3700  */
3701  Argument* clone() const override {
3702  return new Argument(*this);
3703  }
3704 
3705  /// \name Getters
3706  /// \{
3707 
3708  /**
3709  * \brief Return type (ast::AstNodeType) of ast node
3710  *
3711  * Every node in the ast has a type defined in ast::AstNodeType and this
3712  * function is used to retrieve the same.
3713  *
3714  * \return ast node type i.e. ast::AstNodeType::ARGUMENT
3715  *
3716  * \sa Ast::get_node_type_name
3717  */
3718  AstNodeType get_node_type() const noexcept override {
3719  return AstNodeType::ARGUMENT;
3720  }
3721 
3722  /**
3723  * \brief Return type (ast::AstNodeType) of ast node as std::string
3724  *
3725  * Every node in the ast has a type defined in ast::AstNodeType.
3726  * This type name can be returned as a std::string for printing
3727  * node to text/json form.
3728  *
3729  * \return name of the node type as a string i.e. "Argument"
3730  *
3731  * \sa Ast::get_node_name
3732  */
3733  std::string get_node_type_name() const noexcept override {
3734  return "Argument";
3735  }
3736 
3737 
3738  /**
3739  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3740  */
3741  std::shared_ptr<Ast> get_shared_ptr() override {
3742  return std::static_pointer_cast<Argument>(shared_from_this());
3743  }
3744 
3745  /**
3746  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3747  */
3748  std::shared_ptr<const Ast> get_shared_ptr() const override {
3749  return std::static_pointer_cast<const Argument>(shared_from_this());
3750  }
3751 
3752  /**
3753  * \brief Return associated token for the current ast node
3754  *
3755  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
3756  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
3757  * nullptr to store in the nmodl::symtab::SymbolTable.
3758  *
3759  * \return pointer to token if exist otherwise nullptr
3760  */
3761  const ModToken* get_token() const noexcept override {
3762  return token.get();
3763  }
3764 
3765 
3766 
3767 
3768 
3769 
3770 /**
3771  * \brief Return name of the node
3772  *
3773  * Some ast nodes have a member marked designated as node name. For example,
3774  * in case of this ast::Identifier has name designated as a
3775  * node name.
3776  *
3777  * @return name of the node as std::string
3778  *
3779  * \sa Ast::get_node_type_name
3780  */
3781 std::string get_node_name() const override;
3782 
3783 
3784  /**
3785  * \brief Getter for member variable \ref Argument.name
3786  */
3787  const std::shared_ptr<Identifier>& get_name() const noexcept {
3788  return name;
3789  }
3790 
3791 
3792 
3793 
3794 
3795 
3796 
3797  /**
3798  * \brief Getter for member variable \ref Argument.unit
3799  */
3800  const std::shared_ptr<Unit>& get_unit() const noexcept {
3801  return unit;
3802  }
3803 
3804 
3805 
3806  /// \}
3807 
3808  /// \name Setters
3809  /// \{
3810 
3811 
3812  /**
3813  * \brief Set token for the current ast node
3814  */
3815  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
3816 
3817 
3818 
3819 
3820  /**
3821  * \brief Setter for member variable \ref Argument.name (rvalue reference)
3822  */
3823  void set_name(std::shared_ptr<Identifier>&& name);
3824 
3825  /**
3826  * \brief Setter for member variable \ref Argument.name
3827  */
3828  void set_name(const std::shared_ptr<Identifier>& name);
3829 
3830 
3831  /**
3832  * \brief Setter for member variable \ref Argument.unit (rvalue reference)
3833  */
3834  void set_unit(std::shared_ptr<Unit>&& unit);
3835 
3836  /**
3837  * \brief Setter for member variable \ref Argument.unit
3838  */
3839  void set_unit(const std::shared_ptr<Unit>& unit);
3840 
3841 
3842  /// \}
3843 
3844  /// \name Visitor
3845  /// \{
3846 
3847  /**
3848  * \brief visit children i.e. member variables of current node using provided visitor
3849  *
3850  * Different nodes in the AST have different members (i.e. children). This method
3851  * recursively visits children using provided visitor.
3852  *
3853  * \param v Concrete visitor that will be used to recursively visit children
3854  *
3855  * \sa Ast::visit_children for example.
3856  */
3857  void visit_children(visitor::Visitor& v) override;
3858 
3859  /**
3860  * \brief visit children i.e. member variables of current node using provided visitor
3861  *
3862  * Different nodes in the AST have different members (i.e. children). This method
3863  * recursively visits children using provided visitor.
3864  *
3865  * \param v Concrete constant visitor that will be used to recursively visit children
3866  *
3867  * \sa Ast::visit_children for example.
3868  */
3869  void visit_children(visitor::ConstVisitor& v) const override;
3870 
3871  /**
3872  * \brief accept (or visit) the current AST node using provided visitor
3873  *
3874  * Instead of visiting children of AST node, like Ast::visit_children,
3875  * accept allows to visit the current node itself using provided concrete
3876  * visitor.
3877  *
3878  * \param v Concrete visitor that will be used to recursively visit node
3879  *
3880  * \sa Ast::accept for example.
3881  */
3882  void accept(visitor::Visitor& v) override;
3883 
3884  /**
3885  * \copydoc accept(visitor::Visitor&)
3886  */
3887  void accept(visitor::ConstVisitor& v) const override;
3888 
3889  /// \}
3890 
3891 
3892 
3893  private:
3894  /**
3895  * \brief Set this object as parent for all the children
3896  *
3897  * This should be called in every object (with children) constructor
3898  * to set parents. Since it is called only in the constructors it
3899  * should not be virtual to avoid ambiguities (issue #295).
3900  */
3901  void set_parent_in_children();
3902 };
3903 
3904 /** @} */ // end of ast_class
3905 
3906 
3907 } // namespace ast
3908 } // namespace nmodl
3909 #endif // !NMODL_AST_ARGUMENT_HPP
3910 #ifndef NMODL_AST_REACT_VAR_NAME_HPP
3911 #define NMODL_AST_REACT_VAR_NAME_HPP
3912 
3913 
3914 namespace nmodl {
3915 namespace ast {
3916 
3917 /**
3918  * @addtogroup ast_class
3919  * @ingroup ast
3920  * @{
3921  */
3922 
3923 /**
3924  * \brief TODO
3925  *
3926  *
3927 */
3928 class ReactVarName : public Identifier {
3929  private:
3930  /// TODO
3931  std::shared_ptr<Integer> value;
3932  /// TODO
3933  std::shared_ptr<VarName> name;
3934  /// token with location information
3935  std::shared_ptr<ModToken> token;
3936 
3937  public:
3938 
3939  /// \name Ctor & dtor
3940  /// \{
3941 
3942  explicit ReactVarName(Integer* value, VarName* name);
3943  explicit ReactVarName(const std::shared_ptr<Integer>& value, const std::shared_ptr<VarName>& name);
3944  ReactVarName(const ReactVarName& obj);
3945 
3946 
3947  virtual ~ReactVarName() = default;
3948 
3949  /// \}
3950 
3951 
3952 
3953 
3954 
3955 
3956  /**
3957  * \brief Check if the ast node is an instance of ast::ReactVarName
3958  * \return true as object is of type ast::ReactVarName
3959  */
3960  bool is_react_var_name () const noexcept override {
3961  return true;
3962  }
3963 
3964  /**
3965  * \brief Return a copy of the current node
3966  *
3967  * Recursively make a new copy/clone of the current node including
3968  * all members and return a pointer to the node. This is used for
3969  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3970  * ast.
3971  *
3972  * @return pointer to the clone/copy of the current node
3973  */
3974  ReactVarName* clone() const override {
3975  return new ReactVarName(*this);
3976  }
3977 
3978  /// \name Getters
3979  /// \{
3980 
3981  /**
3982  * \brief Return type (ast::AstNodeType) of ast node
3983  *
3984  * Every node in the ast has a type defined in ast::AstNodeType and this
3985  * function is used to retrieve the same.
3986  *
3987  * \return ast node type i.e. ast::AstNodeType::REACT_VAR_NAME
3988  *
3989  * \sa Ast::get_node_type_name
3990  */
3991  AstNodeType get_node_type() const noexcept override {
3993  }
3994 
3995  /**
3996  * \brief Return type (ast::AstNodeType) of ast node as std::string
3997  *
3998  * Every node in the ast has a type defined in ast::AstNodeType.
3999  * This type name can be returned as a std::string for printing
4000  * node to text/json form.
4001  *
4002  * \return name of the node type as a string i.e. "ReactVarName"
4003  *
4004  * \sa Ast::get_node_name
4005  */
4006  std::string get_node_type_name() const noexcept override {
4007  return "ReactVarName";
4008  }
4009 
4010 
4011  /**
4012  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4013  */
4014  std::shared_ptr<Ast> get_shared_ptr() override {
4015  return std::static_pointer_cast<ReactVarName>(shared_from_this());
4016  }
4017 
4018  /**
4019  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4020  */
4021  std::shared_ptr<const Ast> get_shared_ptr() const override {
4022  return std::static_pointer_cast<const ReactVarName>(shared_from_this());
4023  }
4024 
4025  /**
4026  * \brief Return associated token for the current ast node
4027  *
4028  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
4029  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
4030  * nullptr to store in the nmodl::symtab::SymbolTable.
4031  *
4032  * \return pointer to token if exist otherwise nullptr
4033  */
4034  const ModToken* get_token() const noexcept override {
4035  return token.get();
4036  }
4037 
4038 
4039 
4040 
4041 
4042 
4043 
4044 
4045  /**
4046  * \brief Getter for member variable \ref ReactVarName.value
4047  */
4048  const std::shared_ptr<Integer>& get_value() const noexcept {
4049  return value;
4050  }
4051 
4052 
4053 
4054 
4055 
4056 /**
4057  * \brief Return name of the node
4058  *
4059  * Some ast nodes have a member marked designated as node name. For example,
4060  * in case of this ast::VarName has name designated as a
4061  * node name.
4062  *
4063  * @return name of the node as std::string
4064  *
4065  * \sa Ast::get_node_type_name
4066  */
4067 std::string get_node_name() const override;
4068 
4069 
4070  /**
4071  * \brief Getter for member variable \ref ReactVarName.name
4072  */
4073  const std::shared_ptr<VarName>& get_name() const noexcept {
4074  return name;
4075  }
4076 
4077 
4078 
4079  /// \}
4080 
4081  /// \name Setters
4082  /// \{
4083 
4084 
4085  /**
4086  * \brief Set token for the current ast node
4087  */
4088  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
4089 
4090 
4091 
4092 
4093  /**
4094  * \brief Setter for member variable \ref ReactVarName.value (rvalue reference)
4095  */
4096  void set_value(std::shared_ptr<Integer>&& value);
4097 
4098  /**
4099  * \brief Setter for member variable \ref ReactVarName.value
4100  */
4101  void set_value(const std::shared_ptr<Integer>& value);
4102 
4103 
4104  /**
4105  * \brief Setter for member variable \ref ReactVarName.name (rvalue reference)
4106  */
4107  void set_name(std::shared_ptr<VarName>&& name);
4108 
4109  /**
4110  * \brief Setter for member variable \ref ReactVarName.name
4111  */
4112  void set_name(const std::shared_ptr<VarName>& name);
4113 
4114 
4115  /// \}
4116 
4117  /// \name Visitor
4118  /// \{
4119 
4120  /**
4121  * \brief visit children i.e. member variables of current node using provided visitor
4122  *
4123  * Different nodes in the AST have different members (i.e. children). This method
4124  * recursively visits children using provided visitor.
4125  *
4126  * \param v Concrete visitor that will be used to recursively visit children
4127  *
4128  * \sa Ast::visit_children for example.
4129  */
4130  void visit_children(visitor::Visitor& v) override;
4131 
4132  /**
4133  * \brief visit children i.e. member variables of current node using provided visitor
4134  *
4135  * Different nodes in the AST have different members (i.e. children). This method
4136  * recursively visits children using provided visitor.
4137  *
4138  * \param v Concrete constant visitor that will be used to recursively visit children
4139  *
4140  * \sa Ast::visit_children for example.
4141  */
4142  void visit_children(visitor::ConstVisitor& v) const override;
4143 
4144  /**
4145  * \brief accept (or visit) the current AST node using provided visitor
4146  *
4147  * Instead of visiting children of AST node, like Ast::visit_children,
4148  * accept allows to visit the current node itself using provided concrete
4149  * visitor.
4150  *
4151  * \param v Concrete visitor that will be used to recursively visit node
4152  *
4153  * \sa Ast::accept for example.
4154  */
4155  void accept(visitor::Visitor& v) override;
4156 
4157  /**
4158  * \copydoc accept(visitor::Visitor&)
4159  */
4160  void accept(visitor::ConstVisitor& v) const override;
4161 
4162  /// \}
4163 
4164 
4165 
4166  private:
4167  /**
4168  * \brief Set this object as parent for all the children
4169  *
4170  * This should be called in every object (with children) constructor
4171  * to set parents. Since it is called only in the constructors it
4172  * should not be virtual to avoid ambiguities (issue #295).
4173  */
4174  void set_parent_in_children();
4175 };
4176 
4177 /** @} */ // end of ast_class
4178 
4179 
4180 } // namespace ast
4181 } // namespace nmodl
4182 #endif // !NMODL_AST_REACT_VAR_NAME_HPP
4183 #ifndef NMODL_AST_READ_ION_VAR_HPP
4184 #define NMODL_AST_READ_ION_VAR_HPP
4185 
4186 
4187 namespace nmodl {
4188 namespace ast {
4189 
4190 /**
4191  * @addtogroup ast_class
4192  * @ingroup ast
4193  * @{
4194  */
4195 
4196 /**
4197  * \brief TODO
4198  *
4199  *
4200 */
4201 class ReadIonVar : public Identifier {
4202  private:
4203  /// TODO
4204  std::shared_ptr<Name> name;
4205  /// token with location information
4206  std::shared_ptr<ModToken> token;
4207 
4208  public:
4209 
4210  /// \name Ctor & dtor
4211  /// \{
4212 
4213  explicit ReadIonVar(Name* name);
4214  explicit ReadIonVar(const std::shared_ptr<Name>& name);
4215  ReadIonVar(const ReadIonVar& obj);
4216 
4217 
4218  virtual ~ReadIonVar() = default;
4219 
4220  /// \}
4221 
4222 
4223 
4224 
4225 
4226 
4227  /**
4228  * \brief Check if the ast node is an instance of ast::ReadIonVar
4229  * \return true as object is of type ast::ReadIonVar
4230  */
4231  bool is_read_ion_var () const noexcept override {
4232  return true;
4233  }
4234 
4235  /**
4236  * \brief Return a copy of the current node
4237  *
4238  * Recursively make a new copy/clone of the current node including
4239  * all members and return a pointer to the node. This is used for
4240  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4241  * ast.
4242  *
4243  * @return pointer to the clone/copy of the current node
4244  */
4245  ReadIonVar* clone() const override {
4246  return new ReadIonVar(*this);
4247  }
4248 
4249  /// \name Getters
4250  /// \{
4251 
4252  /**
4253  * \brief Return type (ast::AstNodeType) of ast node
4254  *
4255  * Every node in the ast has a type defined in ast::AstNodeType and this
4256  * function is used to retrieve the same.
4257  *
4258  * \return ast node type i.e. ast::AstNodeType::READ_ION_VAR
4259  *
4260  * \sa Ast::get_node_type_name
4261  */
4262  AstNodeType get_node_type() const noexcept override {
4264  }
4265 
4266  /**
4267  * \brief Return type (ast::AstNodeType) of ast node as std::string
4268  *
4269  * Every node in the ast has a type defined in ast::AstNodeType.
4270  * This type name can be returned as a std::string for printing
4271  * node to text/json form.
4272  *
4273  * \return name of the node type as a string i.e. "ReadIonVar"
4274  *
4275  * \sa Ast::get_node_name
4276  */
4277  std::string get_node_type_name() const noexcept override {
4278  return "ReadIonVar";
4279  }
4280 
4281 
4282  /**
4283  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4284  */
4285  std::shared_ptr<Ast> get_shared_ptr() override {
4286  return std::static_pointer_cast<ReadIonVar>(shared_from_this());
4287  }
4288 
4289  /**
4290  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4291  */
4292  std::shared_ptr<const Ast> get_shared_ptr() const override {
4293  return std::static_pointer_cast<const ReadIonVar>(shared_from_this());
4294  }
4295 
4296  /**
4297  * \brief Return associated token for the current ast node
4298  *
4299  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
4300  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
4301  * nullptr to store in the nmodl::symtab::SymbolTable.
4302  *
4303  * \return pointer to token if exist otherwise nullptr
4304  */
4305  const ModToken* get_token() const noexcept override {
4306  return token.get();
4307  }
4308 
4309 
4310 
4311 
4312 
4313 
4314 /**
4315  * \brief Return name of the node
4316  *
4317  * Some ast nodes have a member marked designated as node name. For example,
4318  * in case of this ast::Name has name designated as a
4319  * node name.
4320  *
4321  * @return name of the node as std::string
4322  *
4323  * \sa Ast::get_node_type_name
4324  */
4325 std::string get_node_name() const override;
4326 
4327 
4328  /**
4329  * \brief Getter for member variable \ref ReadIonVar.name
4330  */
4331  const std::shared_ptr<Name>& get_name() const noexcept {
4332  return name;
4333  }
4334 
4335 
4336 
4337  /// \}
4338 
4339  /// \name Setters
4340  /// \{
4341 
4342 
4343  /**
4344  * \brief Set token for the current ast node
4345  */
4346  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
4347 
4348 
4349 
4350 
4351  /**
4352  * \brief Setter for member variable \ref ReadIonVar.name (rvalue reference)
4353  */
4354  void set_name(std::shared_ptr<Name>&& name);
4355 
4356  /**
4357  * \brief Setter for member variable \ref ReadIonVar.name
4358  */
4359  void set_name(const std::shared_ptr<Name>& name);
4360 
4361 
4362  /// \}
4363 
4364  /// \name Visitor
4365  /// \{
4366 
4367  /**
4368  * \brief visit children i.e. member variables of current node using provided visitor
4369  *
4370  * Different nodes in the AST have different members (i.e. children). This method
4371  * recursively visits children using provided visitor.
4372  *
4373  * \param v Concrete visitor that will be used to recursively visit children
4374  *
4375  * \sa Ast::visit_children for example.
4376  */
4377  void visit_children(visitor::Visitor& v) override;
4378 
4379  /**
4380  * \brief visit children i.e. member variables of current node using provided visitor
4381  *
4382  * Different nodes in the AST have different members (i.e. children). This method
4383  * recursively visits children using provided visitor.
4384  *
4385  * \param v Concrete constant visitor that will be used to recursively visit children
4386  *
4387  * \sa Ast::visit_children for example.
4388  */
4389  void visit_children(visitor::ConstVisitor& v) const override;
4390 
4391  /**
4392  * \brief accept (or visit) the current AST node using provided visitor
4393  *
4394  * Instead of visiting children of AST node, like Ast::visit_children,
4395  * accept allows to visit the current node itself using provided concrete
4396  * visitor.
4397  *
4398  * \param v Concrete visitor that will be used to recursively visit node
4399  *
4400  * \sa Ast::accept for example.
4401  */
4402  void accept(visitor::Visitor& v) override;
4403 
4404  /**
4405  * \copydoc accept(visitor::Visitor&)
4406  */
4407  void accept(visitor::ConstVisitor& v) const override;
4408 
4409  /// \}
4410 
4411 
4412 
4413  private:
4414  /**
4415  * \brief Set this object as parent for all the children
4416  *
4417  * This should be called in every object (with children) constructor
4418  * to set parents. Since it is called only in the constructors it
4419  * should not be virtual to avoid ambiguities (issue #295).
4420  */
4421  void set_parent_in_children();
4422 };
4423 
4424 /** @} */ // end of ast_class
4425 
4426 
4427 } // namespace ast
4428 } // namespace nmodl
4429 #endif // !NMODL_AST_READ_ION_VAR_HPP
4430 #ifndef NMODL_AST_WRITE_ION_VAR_HPP
4431 #define NMODL_AST_WRITE_ION_VAR_HPP
4432 
4433 
4434 namespace nmodl {
4435 namespace ast {
4436 
4437 /**
4438  * @addtogroup ast_class
4439  * @ingroup ast
4440  * @{
4441  */
4442 
4443 /**
4444  * \brief TODO
4445  *
4446  *
4447 */
4448 class WriteIonVar : public Identifier {
4449  private:
4450  /// TODO
4451  std::shared_ptr<Name> name;
4452  /// token with location information
4453  std::shared_ptr<ModToken> token;
4454 
4455  public:
4456 
4457  /// \name Ctor & dtor
4458  /// \{
4459 
4460  explicit WriteIonVar(Name* name);
4461  explicit WriteIonVar(const std::shared_ptr<Name>& name);
4462  WriteIonVar(const WriteIonVar& obj);
4463 
4464 
4465  virtual ~WriteIonVar() = default;
4466 
4467  /// \}
4468 
4469 
4470 
4471 
4472 
4473 
4474  /**
4475  * \brief Check if the ast node is an instance of ast::WriteIonVar
4476  * \return true as object is of type ast::WriteIonVar
4477  */
4478  bool is_write_ion_var () const noexcept override {
4479  return true;
4480  }
4481 
4482  /**
4483  * \brief Return a copy of the current node
4484  *
4485  * Recursively make a new copy/clone of the current node including
4486  * all members and return a pointer to the node. This is used for
4487  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4488  * ast.
4489  *
4490  * @return pointer to the clone/copy of the current node
4491  */
4492  WriteIonVar* clone() const override {
4493  return new WriteIonVar(*this);
4494  }
4495 
4496  /// \name Getters
4497  /// \{
4498 
4499  /**
4500  * \brief Return type (ast::AstNodeType) of ast node
4501  *
4502  * Every node in the ast has a type defined in ast::AstNodeType and this
4503  * function is used to retrieve the same.
4504  *
4505  * \return ast node type i.e. ast::AstNodeType::WRITE_ION_VAR
4506  *
4507  * \sa Ast::get_node_type_name
4508  */
4509  AstNodeType get_node_type() const noexcept override {
4511  }
4512 
4513  /**
4514  * \brief Return type (ast::AstNodeType) of ast node as std::string
4515  *
4516  * Every node in the ast has a type defined in ast::AstNodeType.
4517  * This type name can be returned as a std::string for printing
4518  * node to text/json form.
4519  *
4520  * \return name of the node type as a string i.e. "WriteIonVar"
4521  *
4522  * \sa Ast::get_node_name
4523  */
4524  std::string get_node_type_name() const noexcept override {
4525  return "WriteIonVar";
4526  }
4527 
4528 
4529  /**
4530  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4531  */
4532  std::shared_ptr<Ast> get_shared_ptr() override {
4533  return std::static_pointer_cast<WriteIonVar>(shared_from_this());
4534  }
4535 
4536  /**
4537  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4538  */
4539  std::shared_ptr<const Ast> get_shared_ptr() const override {
4540  return std::static_pointer_cast<const WriteIonVar>(shared_from_this());
4541  }
4542 
4543  /**
4544  * \brief Return associated token for the current ast node
4545  *
4546  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
4547  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
4548  * nullptr to store in the nmodl::symtab::SymbolTable.
4549  *
4550  * \return pointer to token if exist otherwise nullptr
4551  */
4552  const ModToken* get_token() const noexcept override {
4553  return token.get();
4554  }
4555 
4556 
4557 
4558 
4559 
4560 
4561 /**
4562  * \brief Return name of the node
4563  *
4564  * Some ast nodes have a member marked designated as node name. For example,
4565  * in case of this ast::Name has name designated as a
4566  * node name.
4567  *
4568  * @return name of the node as std::string
4569  *
4570  * \sa Ast::get_node_type_name
4571  */
4572 std::string get_node_name() const override;
4573 
4574 
4575  /**
4576  * \brief Getter for member variable \ref WriteIonVar.name
4577  */
4578  const std::shared_ptr<Name>& get_name() const noexcept {
4579  return name;
4580  }
4581 
4582 
4583 
4584  /// \}
4585 
4586  /// \name Setters
4587  /// \{
4588 
4589 
4590  /**
4591  * \brief Set token for the current ast node
4592  */
4593  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
4594 
4595 
4596 
4597 
4598  /**
4599  * \brief Setter for member variable \ref WriteIonVar.name (rvalue reference)
4600  */
4601  void set_name(std::shared_ptr<Name>&& name);
4602 
4603  /**
4604  * \brief Setter for member variable \ref WriteIonVar.name
4605  */
4606  void set_name(const std::shared_ptr<Name>& name);
4607 
4608 
4609  /// \}
4610 
4611  /// \name Visitor
4612  /// \{
4613 
4614  /**
4615  * \brief visit children i.e. member variables of current node using provided visitor
4616  *
4617  * Different nodes in the AST have different members (i.e. children). This method
4618  * recursively visits children using provided visitor.
4619  *
4620  * \param v Concrete visitor that will be used to recursively visit children
4621  *
4622  * \sa Ast::visit_children for example.
4623  */
4624  void visit_children(visitor::Visitor& v) override;
4625 
4626  /**
4627  * \brief visit children i.e. member variables of current node using provided visitor
4628  *
4629  * Different nodes in the AST have different members (i.e. children). This method
4630  * recursively visits children using provided visitor.
4631  *
4632  * \param v Concrete constant visitor that will be used to recursively visit children
4633  *
4634  * \sa Ast::visit_children for example.
4635  */
4636  void visit_children(visitor::ConstVisitor& v) const override;
4637 
4638  /**
4639  * \brief accept (or visit) the current AST node using provided visitor
4640  *
4641  * Instead of visiting children of AST node, like Ast::visit_children,
4642  * accept allows to visit the current node itself using provided concrete
4643  * visitor.
4644  *
4645  * \param v Concrete visitor that will be used to recursively visit node
4646  *
4647  * \sa Ast::accept for example.
4648  */
4649  void accept(visitor::Visitor& v) override;
4650 
4651  /**
4652  * \copydoc accept(visitor::Visitor&)
4653  */
4654  void accept(visitor::ConstVisitor& v) const override;
4655 
4656  /// \}
4657 
4658 
4659 
4660  private:
4661  /**
4662  * \brief Set this object as parent for all the children
4663  *
4664  * This should be called in every object (with children) constructor
4665  * to set parents. Since it is called only in the constructors it
4666  * should not be virtual to avoid ambiguities (issue #295).
4667  */
4668  void set_parent_in_children();
4669 };
4670 
4671 /** @} */ // end of ast_class
4672 
4673 
4674 } // namespace ast
4675 } // namespace nmodl
4676 #endif // !NMODL_AST_WRITE_ION_VAR_HPP
4677 #ifndef NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
4678 #define NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
4679 
4680 
4681 namespace nmodl {
4682 namespace ast {
4683 
4684 /**
4685  * @addtogroup ast_class
4686  * @ingroup ast
4687  * @{
4688  */
4689 
4690 /**
4691  * \brief TODO
4692  *
4693  *
4694 */
4696  private:
4697  /// TODO
4698  std::shared_ptr<Name> name;
4699  /// token with location information
4700  std::shared_ptr<ModToken> token;
4701 
4702  public:
4703 
4704  /// \name Ctor & dtor
4705  /// \{
4706 
4707  explicit NonspecificCurVar(Name* name);
4708  explicit NonspecificCurVar(const std::shared_ptr<Name>& name);
4710 
4711 
4712  virtual ~NonspecificCurVar() = default;
4713 
4714  /// \}
4715 
4716 
4717 
4718 
4719 
4720 
4721  /**
4722  * \brief Check if the ast node is an instance of ast::NonspecificCurVar
4723  * \return true as object is of type ast::NonspecificCurVar
4724  */
4725  bool is_nonspecific_cur_var () const noexcept override {
4726  return true;
4727  }
4728 
4729  /**
4730  * \brief Return a copy of the current node
4731  *
4732  * Recursively make a new copy/clone of the current node including
4733  * all members and return a pointer to the node. This is used for
4734  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4735  * ast.
4736  *
4737  * @return pointer to the clone/copy of the current node
4738  */
4739  NonspecificCurVar* clone() const override {
4740  return new NonspecificCurVar(*this);
4741  }
4742 
4743  /// \name Getters
4744  /// \{
4745 
4746  /**
4747  * \brief Return type (ast::AstNodeType) of ast node
4748  *
4749  * Every node in the ast has a type defined in ast::AstNodeType and this
4750  * function is used to retrieve the same.
4751  *
4752  * \return ast node type i.e. ast::AstNodeType::NONSPECIFIC_CUR_VAR
4753  *
4754  * \sa Ast::get_node_type_name
4755  */
4756  AstNodeType get_node_type() const noexcept override {
4758  }
4759 
4760  /**
4761  * \brief Return type (ast::AstNodeType) of ast node as std::string
4762  *
4763  * Every node in the ast has a type defined in ast::AstNodeType.
4764  * This type name can be returned as a std::string for printing
4765  * node to text/json form.
4766  *
4767  * \return name of the node type as a string i.e. "NonspecificCurVar"
4768  *
4769  * \sa Ast::get_node_name
4770  */
4771  std::string get_node_type_name() const noexcept override {
4772  return "NonspecificCurVar";
4773  }
4774 
4775 
4776  /**
4777  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4778  */
4779  std::shared_ptr<Ast> get_shared_ptr() override {
4780  return std::static_pointer_cast<NonspecificCurVar>(shared_from_this());
4781  }
4782 
4783  /**
4784  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4785  */
4786  std::shared_ptr<const Ast> get_shared_ptr() const override {
4787  return std::static_pointer_cast<const NonspecificCurVar>(shared_from_this());
4788  }
4789 
4790  /**
4791  * \brief Return associated token for the current ast node
4792  *
4793  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
4794  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
4795  * nullptr to store in the nmodl::symtab::SymbolTable.
4796  *
4797  * \return pointer to token if exist otherwise nullptr
4798  */
4799  const ModToken* get_token() const noexcept override {
4800  return token.get();
4801  }
4802 
4803 
4804 
4805 
4806 
4807 
4808 /**
4809  * \brief Return name of the node
4810  *
4811  * Some ast nodes have a member marked designated as node name. For example,
4812  * in case of this ast::Name has name designated as a
4813  * node name.
4814  *
4815  * @return name of the node as std::string
4816  *
4817  * \sa Ast::get_node_type_name
4818  */
4819 std::string get_node_name() const override;
4820 
4821 
4822  /**
4823  * \brief Getter for member variable \ref NonspecificCurVar.name
4824  */
4825  const std::shared_ptr<Name>& get_name() const noexcept {
4826  return name;
4827  }
4828 
4829 
4830 
4831  /// \}
4832 
4833  /// \name Setters
4834  /// \{
4835 
4836 
4837  /**
4838  * \brief Set token for the current ast node
4839  */
4840  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
4841 
4842 
4843 
4844 
4845  /**
4846  * \brief Setter for member variable \ref NonspecificCurVar.name (rvalue reference)
4847  */
4848  void set_name(std::shared_ptr<Name>&& name);
4849 
4850  /**
4851  * \brief Setter for member variable \ref NonspecificCurVar.name
4852  */
4853  void set_name(const std::shared_ptr<Name>& name);
4854 
4855 
4856  /// \}
4857 
4858  /// \name Visitor
4859  /// \{
4860 
4861  /**
4862  * \brief visit children i.e. member variables of current node using provided visitor
4863  *
4864  * Different nodes in the AST have different members (i.e. children). This method
4865  * recursively visits children using provided visitor.
4866  *
4867  * \param v Concrete visitor that will be used to recursively visit children
4868  *
4869  * \sa Ast::visit_children for example.
4870  */
4871  void visit_children(visitor::Visitor& v) override;
4872 
4873  /**
4874  * \brief visit children i.e. member variables of current node using provided visitor
4875  *
4876  * Different nodes in the AST have different members (i.e. children). This method
4877  * recursively visits children using provided visitor.
4878  *
4879  * \param v Concrete constant visitor that will be used to recursively visit children
4880  *
4881  * \sa Ast::visit_children for example.
4882  */
4883  void visit_children(visitor::ConstVisitor& v) const override;
4884 
4885  /**
4886  * \brief accept (or visit) the current AST node using provided visitor
4887  *
4888  * Instead of visiting children of AST node, like Ast::visit_children,
4889  * accept allows to visit the current node itself using provided concrete
4890  * visitor.
4891  *
4892  * \param v Concrete visitor that will be used to recursively visit node
4893  *
4894  * \sa Ast::accept for example.
4895  */
4896  void accept(visitor::Visitor& v) override;
4897 
4898  /**
4899  * \copydoc accept(visitor::Visitor&)
4900  */
4901  void accept(visitor::ConstVisitor& v) const override;
4902 
4903  /// \}
4904 
4905 
4906 
4907  private:
4908  /**
4909  * \brief Set this object as parent for all the children
4910  *
4911  * This should be called in every object (with children) constructor
4912  * to set parents. Since it is called only in the constructors it
4913  * should not be virtual to avoid ambiguities (issue #295).
4914  */
4915  void set_parent_in_children();
4916 };
4917 
4918 /** @} */ // end of ast_class
4919 
4920 
4921 } // namespace ast
4922 } // namespace nmodl
4923 #endif // !NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
4924 #ifndef NMODL_AST_ELECTRODE_CUR_VAR_HPP
4925 #define NMODL_AST_ELECTRODE_CUR_VAR_HPP
4926 
4927 
4928 namespace nmodl {
4929 namespace ast {
4930 
4931 /**
4932  * @addtogroup ast_class
4933  * @ingroup ast
4934  * @{
4935  */
4936 
4937 /**
4938  * \brief TODO
4939  *
4940  *
4941 */
4942 class ElectrodeCurVar : public Identifier {
4943  private:
4944  /// TODO
4945  std::shared_ptr<Name> name;
4946  /// token with location information
4947  std::shared_ptr<ModToken> token;
4948 
4949  public:
4950 
4951  /// \name Ctor & dtor
4952  /// \{
4953 
4954  explicit ElectrodeCurVar(Name* name);
4955  explicit ElectrodeCurVar(const std::shared_ptr<Name>& name);
4956  ElectrodeCurVar(const ElectrodeCurVar& obj);
4957 
4958 
4959  virtual ~ElectrodeCurVar() = default;
4960 
4961  /// \}
4962 
4963 
4964 
4965 
4966 
4967 
4968  /**
4969  * \brief Check if the ast node is an instance of ast::ElectrodeCurVar
4970  * \return true as object is of type ast::ElectrodeCurVar
4971  */
4972  bool is_electrode_cur_var () const noexcept override {
4973  return true;
4974  }
4975 
4976  /**
4977  * \brief Return a copy of the current node
4978  *
4979  * Recursively make a new copy/clone of the current node including
4980  * all members and return a pointer to the node. This is used for
4981  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4982  * ast.
4983  *
4984  * @return pointer to the clone/copy of the current node
4985  */
4986  ElectrodeCurVar* clone() const override {
4987  return new ElectrodeCurVar(*this);
4988  }
4989 
4990  /// \name Getters
4991  /// \{
4992 
4993  /**
4994  * \brief Return type (ast::AstNodeType) of ast node
4995  *
4996  * Every node in the ast has a type defined in ast::AstNodeType and this
4997  * function is used to retrieve the same.
4998  *
4999  * \return ast node type i.e. ast::AstNodeType::ELECTRODE_CUR_VAR
5000  *
5001  * \sa Ast::get_node_type_name
5002  */
5003  AstNodeType get_node_type() const noexcept override {
5005  }
5006 
5007  /**
5008  * \brief Return type (ast::AstNodeType) of ast node as std::string
5009  *
5010  * Every node in the ast has a type defined in ast::AstNodeType.
5011  * This type name can be returned as a std::string for printing
5012  * node to text/json form.
5013  *
5014  * \return name of the node type as a string i.e. "ElectrodeCurVar"
5015  *
5016  * \sa Ast::get_node_name
5017  */
5018  std::string get_node_type_name() const noexcept override {
5019  return "ElectrodeCurVar";
5020  }
5021 
5022 
5023  /**
5024  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5025  */
5026  std::shared_ptr<Ast> get_shared_ptr() override {
5027  return std::static_pointer_cast<ElectrodeCurVar>(shared_from_this());
5028  }
5029 
5030  /**
5031  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5032  */
5033  std::shared_ptr<const Ast> get_shared_ptr() const override {
5034  return std::static_pointer_cast<const ElectrodeCurVar>(shared_from_this());
5035  }
5036 
5037  /**
5038  * \brief Return associated token for the current ast node
5039  *
5040  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
5041  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
5042  * nullptr to store in the nmodl::symtab::SymbolTable.
5043  *
5044  * \return pointer to token if exist otherwise nullptr
5045  */
5046  const ModToken* get_token() const noexcept override {
5047  return token.get();
5048  }
5049 
5050 
5051 
5052 
5053 
5054 
5055 /**
5056  * \brief Return name of the node
5057  *
5058  * Some ast nodes have a member marked designated as node name. For example,
5059  * in case of this ast::Name has name designated as a
5060  * node name.
5061  *
5062  * @return name of the node as std::string
5063  *
5064  * \sa Ast::get_node_type_name
5065  */
5066 std::string get_node_name() const override;
5067 
5068 
5069  /**
5070  * \brief Getter for member variable \ref ElectrodeCurVar.name
5071  */
5072  const std::shared_ptr<Name>& get_name() const noexcept {
5073  return name;
5074  }
5075 
5076 
5077 
5078  /// \}
5079 
5080  /// \name Setters
5081  /// \{
5082 
5083 
5084  /**
5085  * \brief Set token for the current ast node
5086  */
5087  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
5088 
5089 
5090 
5091 
5092  /**
5093  * \brief Setter for member variable \ref ElectrodeCurVar.name (rvalue reference)
5094  */
5095  void set_name(std::shared_ptr<Name>&& name);
5096 
5097  /**
5098  * \brief Setter for member variable \ref ElectrodeCurVar.name
5099  */
5100  void set_name(const std::shared_ptr<Name>& name);
5101 
5102 
5103  /// \}
5104 
5105  /// \name Visitor
5106  /// \{
5107 
5108  /**
5109  * \brief visit children i.e. member variables of current node using provided visitor
5110  *
5111  * Different nodes in the AST have different members (i.e. children). This method
5112  * recursively visits children using provided visitor.
5113  *
5114  * \param v Concrete visitor that will be used to recursively visit children
5115  *
5116  * \sa Ast::visit_children for example.
5117  */
5118  void visit_children(visitor::Visitor& v) override;
5119 
5120  /**
5121  * \brief visit children i.e. member variables of current node using provided visitor
5122  *
5123  * Different nodes in the AST have different members (i.e. children). This method
5124  * recursively visits children using provided visitor.
5125  *
5126  * \param v Concrete constant visitor that will be used to recursively visit children
5127  *
5128  * \sa Ast::visit_children for example.
5129  */
5130  void visit_children(visitor::ConstVisitor& v) const override;
5131 
5132  /**
5133  * \brief accept (or visit) the current AST node using provided visitor
5134  *
5135  * Instead of visiting children of AST node, like Ast::visit_children,
5136  * accept allows to visit the current node itself using provided concrete
5137  * visitor.
5138  *
5139  * \param v Concrete visitor that will be used to recursively visit node
5140  *
5141  * \sa Ast::accept for example.
5142  */
5143  void accept(visitor::Visitor& v) override;
5144 
5145  /**
5146  * \copydoc accept(visitor::Visitor&)
5147  */
5148  void accept(visitor::ConstVisitor& v) const override;
5149 
5150  /// \}
5151 
5152 
5153 
5154  private:
5155  /**
5156  * \brief Set this object as parent for all the children
5157  *
5158  * This should be called in every object (with children) constructor
5159  * to set parents. Since it is called only in the constructors it
5160  * should not be virtual to avoid ambiguities (issue #295).
5161  */
5162  void set_parent_in_children();
5163 };
5164 
5165 /** @} */ // end of ast_class
5166 
5167 
5168 } // namespace ast
5169 } // namespace nmodl
5170 #endif // !NMODL_AST_ELECTRODE_CUR_VAR_HPP
5171 #ifndef NMODL_AST_SECTION_VAR_HPP
5172 #define NMODL_AST_SECTION_VAR_HPP
5173 
5174 
5175 namespace nmodl {
5176 namespace ast {
5177 
5178 /**
5179  * @addtogroup ast_class
5180  * @ingroup ast
5181  * @{
5182  */
5183 
5184 /**
5185  * \brief TODO
5186  *
5187  *
5188 */
5189 class SectionVar : public Identifier {
5190  private:
5191  /// TODO
5192  std::shared_ptr<Name> name;
5193  /// token with location information
5194  std::shared_ptr<ModToken> token;
5195 
5196  public:
5197 
5198  /// \name Ctor & dtor
5199  /// \{
5200 
5201  explicit SectionVar(Name* name);
5202  explicit SectionVar(const std::shared_ptr<Name>& name);
5203  SectionVar(const SectionVar& obj);
5204 
5205 
5206  virtual ~SectionVar() = default;
5207 
5208  /// \}
5209 
5210 
5211 
5212 
5213 
5214 
5215  /**
5216  * \brief Check if the ast node is an instance of ast::SectionVar
5217  * \return true as object is of type ast::SectionVar
5218  */
5219  bool is_section_var () const noexcept override {
5220  return true;
5221  }
5222 
5223  /**
5224  * \brief Return a copy of the current node
5225  *
5226  * Recursively make a new copy/clone of the current node including
5227  * all members and return a pointer to the node. This is used for
5228  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5229  * ast.
5230  *
5231  * @return pointer to the clone/copy of the current node
5232  */
5233  SectionVar* clone() const override {
5234  return new SectionVar(*this);
5235  }
5236 
5237  /// \name Getters
5238  /// \{
5239 
5240  /**
5241  * \brief Return type (ast::AstNodeType) of ast node
5242  *
5243  * Every node in the ast has a type defined in ast::AstNodeType and this
5244  * function is used to retrieve the same.
5245  *
5246  * \return ast node type i.e. ast::AstNodeType::SECTION_VAR
5247  *
5248  * \sa Ast::get_node_type_name
5249  */
5250  AstNodeType get_node_type() const noexcept override {
5251  return AstNodeType::SECTION_VAR;
5252  }
5253 
5254  /**
5255  * \brief Return type (ast::AstNodeType) of ast node as std::string
5256  *
5257  * Every node in the ast has a type defined in ast::AstNodeType.
5258  * This type name can be returned as a std::string for printing
5259  * node to text/json form.
5260  *
5261  * \return name of the node type as a string i.e. "SectionVar"
5262  *
5263  * \sa Ast::get_node_name
5264  */
5265  std::string get_node_type_name() const noexcept override {
5266  return "SectionVar";
5267  }
5268 
5269 
5270  /**
5271  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5272  */
5273  std::shared_ptr<Ast> get_shared_ptr() override {
5274  return std::static_pointer_cast<SectionVar>(shared_from_this());
5275  }
5276 
5277  /**
5278  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5279  */
5280  std::shared_ptr<const Ast> get_shared_ptr() const override {
5281  return std::static_pointer_cast<const SectionVar>(shared_from_this());
5282  }
5283 
5284  /**
5285  * \brief Return associated token for the current ast node
5286  *
5287  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
5288  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
5289  * nullptr to store in the nmodl::symtab::SymbolTable.
5290  *
5291  * \return pointer to token if exist otherwise nullptr
5292  */
5293  const ModToken* get_token() const noexcept override {
5294  return token.get();
5295  }
5296 
5297 
5298 
5299 
5300 
5301 
5302 /**
5303  * \brief Return name of the node
5304  *
5305  * Some ast nodes have a member marked designated as node name. For example,
5306  * in case of this ast::Name has name designated as a
5307  * node name.
5308  *
5309  * @return name of the node as std::string
5310  *
5311  * \sa Ast::get_node_type_name
5312  */
5313 std::string get_node_name() const override;
5314 
5315 
5316  /**
5317  * \brief Getter for member variable \ref SectionVar.name
5318  */
5319  const std::shared_ptr<Name>& get_name() const noexcept {
5320  return name;
5321  }
5322 
5323 
5324 
5325  /// \}
5326 
5327  /// \name Setters
5328  /// \{
5329 
5330 
5331  /**
5332  * \brief Set token for the current ast node
5333  */
5334  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
5335 
5336 
5337 
5338 
5339  /**
5340  * \brief Setter for member variable \ref SectionVar.name (rvalue reference)
5341  */
5342  void set_name(std::shared_ptr<Name>&& name);
5343 
5344  /**
5345  * \brief Setter for member variable \ref SectionVar.name
5346  */
5347  void set_name(const std::shared_ptr<Name>& name);
5348 
5349 
5350  /// \}
5351 
5352  /// \name Visitor
5353  /// \{
5354 
5355  /**
5356  * \brief visit children i.e. member variables of current node using provided visitor
5357  *
5358  * Different nodes in the AST have different members (i.e. children). This method
5359  * recursively visits children using provided visitor.
5360  *
5361  * \param v Concrete visitor that will be used to recursively visit children
5362  *
5363  * \sa Ast::visit_children for example.
5364  */
5365  void visit_children(visitor::Visitor& v) override;
5366 
5367  /**
5368  * \brief visit children i.e. member variables of current node using provided visitor
5369  *
5370  * Different nodes in the AST have different members (i.e. children). This method
5371  * recursively visits children using provided visitor.
5372  *
5373  * \param v Concrete constant visitor that will be used to recursively visit children
5374  *
5375  * \sa Ast::visit_children for example.
5376  */
5377  void visit_children(visitor::ConstVisitor& v) const override;
5378 
5379  /**
5380  * \brief accept (or visit) the current AST node using provided visitor
5381  *
5382  * Instead of visiting children of AST node, like Ast::visit_children,
5383  * accept allows to visit the current node itself using provided concrete
5384  * visitor.
5385  *
5386  * \param v Concrete visitor that will be used to recursively visit node
5387  *
5388  * \sa Ast::accept for example.
5389  */
5390  void accept(visitor::Visitor& v) override;
5391 
5392  /**
5393  * \copydoc accept(visitor::Visitor&)
5394  */
5395  void accept(visitor::ConstVisitor& v) const override;
5396 
5397  /// \}
5398 
5399 
5400 
5401  private:
5402  /**
5403  * \brief Set this object as parent for all the children
5404  *
5405  * This should be called in every object (with children) constructor
5406  * to set parents. Since it is called only in the constructors it
5407  * should not be virtual to avoid ambiguities (issue #295).
5408  */
5409  void set_parent_in_children();
5410 };
5411 
5412 /** @} */ // end of ast_class
5413 
5414 
5415 } // namespace ast
5416 } // namespace nmodl
5417 #endif // !NMODL_AST_SECTION_VAR_HPP
5418 #ifndef NMODL_AST_RANGE_VAR_HPP
5419 #define NMODL_AST_RANGE_VAR_HPP
5420 
5421 
5422 namespace nmodl {
5423 namespace ast {
5424 
5425 /**
5426  * @addtogroup ast_class
5427  * @ingroup ast
5428  * @{
5429  */
5430 
5431 /**
5432  * \brief TODO
5433  *
5434  *
5435 */
5436 class RangeVar : public Identifier {
5437  private:
5438  /// TODO
5439  std::shared_ptr<Name> name;
5440  /// token with location information
5441  std::shared_ptr<ModToken> token;
5442 
5443  public:
5444 
5445  /// \name Ctor & dtor
5446  /// \{
5447 
5448  explicit RangeVar(Name* name);
5449  explicit RangeVar(const std::shared_ptr<Name>& name);
5450  RangeVar(const RangeVar& obj);
5451 
5452 
5453  virtual ~RangeVar() = default;
5454 
5455  /// \}
5456 
5457 
5458 
5459 
5460 
5461 
5462  /**
5463  * \brief Check if the ast node is an instance of ast::RangeVar
5464  * \return true as object is of type ast::RangeVar
5465  */
5466  bool is_range_var () const noexcept override {
5467  return true;
5468  }
5469 
5470  /**
5471  * \brief Return a copy of the current node
5472  *
5473  * Recursively make a new copy/clone of the current node including
5474  * all members and return a pointer to the node. This is used for
5475  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5476  * ast.
5477  *
5478  * @return pointer to the clone/copy of the current node
5479  */
5480  RangeVar* clone() const override {
5481  return new RangeVar(*this);
5482  }
5483 
5484  /// \name Getters
5485  /// \{
5486 
5487  /**
5488  * \brief Return type (ast::AstNodeType) of ast node
5489  *
5490  * Every node in the ast has a type defined in ast::AstNodeType and this
5491  * function is used to retrieve the same.
5492  *
5493  * \return ast node type i.e. ast::AstNodeType::RANGE_VAR
5494  *
5495  * \sa Ast::get_node_type_name
5496  */
5497  AstNodeType get_node_type() const noexcept override {
5498  return AstNodeType::RANGE_VAR;
5499  }
5500 
5501  /**
5502  * \brief Return type (ast::AstNodeType) of ast node as std::string
5503  *
5504  * Every node in the ast has a type defined in ast::AstNodeType.
5505  * This type name can be returned as a std::string for printing
5506  * node to text/json form.
5507  *
5508  * \return name of the node type as a string i.e. "RangeVar"
5509  *
5510  * \sa Ast::get_node_name
5511  */
5512  std::string get_node_type_name() const noexcept override {
5513  return "RangeVar";
5514  }
5515 
5516 
5517  /**
5518  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5519  */
5520  std::shared_ptr<Ast> get_shared_ptr() override {
5521  return std::static_pointer_cast<RangeVar>(shared_from_this());
5522  }
5523 
5524  /**
5525  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5526  */
5527  std::shared_ptr<const Ast> get_shared_ptr() const override {
5528  return std::static_pointer_cast<const RangeVar>(shared_from_this());
5529  }
5530 
5531  /**
5532  * \brief Return associated token for the current ast node
5533  *
5534  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
5535  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
5536  * nullptr to store in the nmodl::symtab::SymbolTable.
5537  *
5538  * \return pointer to token if exist otherwise nullptr
5539  */
5540  const ModToken* get_token() const noexcept override {
5541  return token.get();
5542  }
5543 
5544 
5545 
5546 
5547 
5548 
5549 /**
5550  * \brief Return name of the node
5551  *
5552  * Some ast nodes have a member marked designated as node name. For example,
5553  * in case of this ast::Name has name designated as a
5554  * node name.
5555  *
5556  * @return name of the node as std::string
5557  *
5558  * \sa Ast::get_node_type_name
5559  */
5560 std::string get_node_name() const override;
5561 
5562 
5563  /**
5564  * \brief Getter for member variable \ref RangeVar.name
5565  */
5566  const std::shared_ptr<Name>& get_name() const noexcept {
5567  return name;
5568  }
5569 
5570 
5571 
5572  /// \}
5573 
5574  /// \name Setters
5575  /// \{
5576 
5577 
5578  /**
5579  * \brief Set token for the current ast node
5580  */
5581  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
5582 
5583 
5584 
5585 
5586  /**
5587  * \brief Setter for member variable \ref RangeVar.name (rvalue reference)
5588  */
5589  void set_name(std::shared_ptr<Name>&& name);
5590 
5591  /**
5592  * \brief Setter for member variable \ref RangeVar.name
5593  */
5594  void set_name(const std::shared_ptr<Name>& name);
5595 
5596 
5597  /// \}
5598 
5599  /// \name Visitor
5600  /// \{
5601 
5602  /**
5603  * \brief visit children i.e. member variables of current node using provided visitor
5604  *
5605  * Different nodes in the AST have different members (i.e. children). This method
5606  * recursively visits children using provided visitor.
5607  *
5608  * \param v Concrete visitor that will be used to recursively visit children
5609  *
5610  * \sa Ast::visit_children for example.
5611  */
5612  void visit_children(visitor::Visitor& v) override;
5613 
5614  /**
5615  * \brief visit children i.e. member variables of current node using provided visitor
5616  *
5617  * Different nodes in the AST have different members (i.e. children). This method
5618  * recursively visits children using provided visitor.
5619  *
5620  * \param v Concrete constant visitor that will be used to recursively visit children
5621  *
5622  * \sa Ast::visit_children for example.
5623  */
5624  void visit_children(visitor::ConstVisitor& v) const override;
5625 
5626  /**
5627  * \brief accept (or visit) the current AST node using provided visitor
5628  *
5629  * Instead of visiting children of AST node, like Ast::visit_children,
5630  * accept allows to visit the current node itself using provided concrete
5631  * visitor.
5632  *
5633  * \param v Concrete visitor that will be used to recursively visit node
5634  *
5635  * \sa Ast::accept for example.
5636  */
5637  void accept(visitor::Visitor& v) override;
5638 
5639  /**
5640  * \copydoc accept(visitor::Visitor&)
5641  */
5642  void accept(visitor::ConstVisitor& v) const override;
5643 
5644  /// \}
5645 
5646 
5647 
5648  private:
5649  /**
5650  * \brief Set this object as parent for all the children
5651  *
5652  * This should be called in every object (with children) constructor
5653  * to set parents. Since it is called only in the constructors it
5654  * should not be virtual to avoid ambiguities (issue #295).
5655  */
5656  void set_parent_in_children();
5657 };
5658 
5659 /** @} */ // end of ast_class
5660 
5661 
5662 } // namespace ast
5663 } // namespace nmodl
5664 #endif // !NMODL_AST_RANGE_VAR_HPP
5665 #ifndef NMODL_AST_GLOBAL_VAR_HPP
5666 #define NMODL_AST_GLOBAL_VAR_HPP
5667 
5668 
5669 namespace nmodl {
5670 namespace ast {
5671 
5672 /**
5673  * @addtogroup ast_class
5674  * @ingroup ast
5675  * @{
5676  */
5677 
5678 /**
5679  * \brief TODO
5680  *
5681  *
5682 */
5683 class GlobalVar : public Identifier {
5684  private:
5685  /// TODO
5686  std::shared_ptr<Name> name;
5687  /// token with location information
5688  std::shared_ptr<ModToken> token;
5689 
5690  public:
5691 
5692  /// \name Ctor & dtor
5693  /// \{
5694 
5695  explicit GlobalVar(Name* name);
5696  explicit GlobalVar(const std::shared_ptr<Name>& name);
5697  GlobalVar(const GlobalVar& obj);
5698 
5699 
5700  virtual ~GlobalVar() = default;
5701 
5702  /// \}
5703 
5704 
5705 
5706 
5707 
5708 
5709  /**
5710  * \brief Check if the ast node is an instance of ast::GlobalVar
5711  * \return true as object is of type ast::GlobalVar
5712  */
5713  bool is_global_var () const noexcept override {
5714  return true;
5715  }
5716 
5717  /**
5718  * \brief Return a copy of the current node
5719  *
5720  * Recursively make a new copy/clone of the current node including
5721  * all members and return a pointer to the node. This is used for
5722  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5723  * ast.
5724  *
5725  * @return pointer to the clone/copy of the current node
5726  */
5727  GlobalVar* clone() const override {
5728  return new GlobalVar(*this);
5729  }
5730 
5731  /// \name Getters
5732  /// \{
5733 
5734  /**
5735  * \brief Return type (ast::AstNodeType) of ast node
5736  *
5737  * Every node in the ast has a type defined in ast::AstNodeType and this
5738  * function is used to retrieve the same.
5739  *
5740  * \return ast node type i.e. ast::AstNodeType::GLOBAL_VAR
5741  *
5742  * \sa Ast::get_node_type_name
5743  */
5744  AstNodeType get_node_type() const noexcept override {
5745  return AstNodeType::GLOBAL_VAR;
5746  }
5747 
5748  /**
5749  * \brief Return type (ast::AstNodeType) of ast node as std::string
5750  *
5751  * Every node in the ast has a type defined in ast::AstNodeType.
5752  * This type name can be returned as a std::string for printing
5753  * node to text/json form.
5754  *
5755  * \return name of the node type as a string i.e. "GlobalVar"
5756  *
5757  * \sa Ast::get_node_name
5758  */
5759  std::string get_node_type_name() const noexcept override {
5760  return "GlobalVar";
5761  }
5762 
5763 
5764  /**
5765  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5766  */
5767  std::shared_ptr<Ast> get_shared_ptr() override {
5768  return std::static_pointer_cast<GlobalVar>(shared_from_this());
5769  }
5770 
5771  /**
5772  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5773  */
5774  std::shared_ptr<const Ast> get_shared_ptr() const override {
5775  return std::static_pointer_cast<const GlobalVar>(shared_from_this());
5776  }
5777 
5778  /**
5779  * \brief Return associated token for the current ast node
5780  *
5781  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
5782  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
5783  * nullptr to store in the nmodl::symtab::SymbolTable.
5784  *
5785  * \return pointer to token if exist otherwise nullptr
5786  */
5787  const ModToken* get_token() const noexcept override {
5788  return token.get();
5789  }
5790 
5791 
5792 
5793 
5794 
5795 
5796 /**
5797  * \brief Return name of the node
5798  *
5799  * Some ast nodes have a member marked designated as node name. For example,
5800  * in case of this ast::Name has name designated as a
5801  * node name.
5802  *
5803  * @return name of the node as std::string
5804  *
5805  * \sa Ast::get_node_type_name
5806  */
5807 std::string get_node_name() const override;
5808 
5809 
5810  /**
5811  * \brief Getter for member variable \ref GlobalVar.name
5812  */
5813  const std::shared_ptr<Name>& get_name() const noexcept {
5814  return name;
5815  }
5816 
5817 
5818 
5819  /// \}
5820 
5821  /// \name Setters
5822  /// \{
5823 
5824 
5825  /**
5826  * \brief Set token for the current ast node
5827  */
5828  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
5829 
5830 
5831 
5832 
5833  /**
5834  * \brief Setter for member variable \ref GlobalVar.name (rvalue reference)
5835  */
5836  void set_name(std::shared_ptr<Name>&& name);
5837 
5838  /**
5839  * \brief Setter for member variable \ref GlobalVar.name
5840  */
5841  void set_name(const std::shared_ptr<Name>& name);
5842 
5843 
5844  /// \}
5845 
5846  /// \name Visitor
5847  /// \{
5848 
5849  /**
5850  * \brief visit children i.e. member variables of current node using provided visitor
5851  *
5852  * Different nodes in the AST have different members (i.e. children). This method
5853  * recursively visits children using provided visitor.
5854  *
5855  * \param v Concrete visitor that will be used to recursively visit children
5856  *
5857  * \sa Ast::visit_children for example.
5858  */
5859  void visit_children(visitor::Visitor& v) override;
5860 
5861  /**
5862  * \brief visit children i.e. member variables of current node using provided visitor
5863  *
5864  * Different nodes in the AST have different members (i.e. children). This method
5865  * recursively visits children using provided visitor.
5866  *
5867  * \param v Concrete constant visitor that will be used to recursively visit children
5868  *
5869  * \sa Ast::visit_children for example.
5870  */
5871  void visit_children(visitor::ConstVisitor& v) const override;
5872 
5873  /**
5874  * \brief accept (or visit) the current AST node using provided visitor
5875  *
5876  * Instead of visiting children of AST node, like Ast::visit_children,
5877  * accept allows to visit the current node itself using provided concrete
5878  * visitor.
5879  *
5880  * \param v Concrete visitor that will be used to recursively visit node
5881  *
5882  * \sa Ast::accept for example.
5883  */
5884  void accept(visitor::Visitor& v) override;
5885 
5886  /**
5887  * \copydoc accept(visitor::Visitor&)
5888  */
5889  void accept(visitor::ConstVisitor& v) const override;
5890 
5891  /// \}
5892 
5893 
5894 
5895  private:
5896  /**
5897  * \brief Set this object as parent for all the children
5898  *
5899  * This should be called in every object (with children) constructor
5900  * to set parents. Since it is called only in the constructors it
5901  * should not be virtual to avoid ambiguities (issue #295).
5902  */
5903  void set_parent_in_children();
5904 };
5905 
5906 /** @} */ // end of ast_class
5907 
5908 
5909 } // namespace ast
5910 } // namespace nmodl
5911 #endif // !NMODL_AST_GLOBAL_VAR_HPP
5912 #ifndef NMODL_AST_POINTER_VAR_HPP
5913 #define NMODL_AST_POINTER_VAR_HPP
5914 
5915 
5916 namespace nmodl {
5917 namespace ast {
5918 
5919 /**
5920  * @addtogroup ast_class
5921  * @ingroup ast
5922  * @{
5923  */
5924 
5925 /**
5926  * \brief TODO
5927  *
5928  *
5929 */
5930 class PointerVar : public Identifier {
5931  private:
5932  /// TODO
5933  std::shared_ptr<Name> name;
5934  /// token with location information
5935  std::shared_ptr<ModToken> token;
5936 
5937  public:
5938 
5939  /// \name Ctor & dtor
5940  /// \{
5941 
5942  explicit PointerVar(Name* name);
5943  explicit PointerVar(const std::shared_ptr<Name>& name);
5944  PointerVar(const PointerVar& obj);
5945 
5946 
5947  virtual ~PointerVar() = default;
5948 
5949  /// \}
5950 
5951 
5952 
5953 
5954 
5955 
5956  /**
5957  * \brief Check if the ast node is an instance of ast::PointerVar
5958  * \return true as object is of type ast::PointerVar
5959  */
5960  bool is_pointer_var () const noexcept override {
5961  return true;
5962  }
5963 
5964  /**
5965  * \brief Return a copy of the current node
5966  *
5967  * Recursively make a new copy/clone of the current node including
5968  * all members and return a pointer to the node. This is used for
5969  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5970  * ast.
5971  *
5972  * @return pointer to the clone/copy of the current node
5973  */
5974  PointerVar* clone() const override {
5975  return new PointerVar(*this);
5976  }
5977 
5978  /// \name Getters
5979  /// \{
5980 
5981  /**
5982  * \brief Return type (ast::AstNodeType) of ast node
5983  *
5984  * Every node in the ast has a type defined in ast::AstNodeType and this
5985  * function is used to retrieve the same.
5986  *
5987  * \return ast node type i.e. ast::AstNodeType::POINTER_VAR
5988  *
5989  * \sa Ast::get_node_type_name
5990  */
5991  AstNodeType get_node_type() const noexcept override {
5992  return AstNodeType::POINTER_VAR;
5993  }
5994 
5995  /**
5996  * \brief Return type (ast::AstNodeType) of ast node as std::string
5997  *
5998  * Every node in the ast has a type defined in ast::AstNodeType.
5999  * This type name can be returned as a std::string for printing
6000  * node to text/json form.
6001  *
6002  * \return name of the node type as a string i.e. "PointerVar"
6003  *
6004  * \sa Ast::get_node_name
6005  */
6006  std::string get_node_type_name() const noexcept override {
6007  return "PointerVar";
6008  }
6009 
6010 
6011  /**
6012  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6013  */
6014  std::shared_ptr<Ast> get_shared_ptr() override {
6015  return std::static_pointer_cast<PointerVar>(shared_from_this());
6016  }
6017 
6018  /**
6019  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6020  */
6021  std::shared_ptr<const Ast> get_shared_ptr() const override {
6022  return std::static_pointer_cast<const PointerVar>(shared_from_this());
6023  }
6024 
6025  /**
6026  * \brief Return associated token for the current ast node
6027  *
6028  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
6029  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
6030  * nullptr to store in the nmodl::symtab::SymbolTable.
6031  *
6032  * \return pointer to token if exist otherwise nullptr
6033  */
6034  const ModToken* get_token() const noexcept override {
6035  return token.get();
6036  }
6037 
6038 
6039 
6040 
6041 
6042 
6043 /**
6044  * \brief Return name of the node
6045  *
6046  * Some ast nodes have a member marked designated as node name. For example,
6047  * in case of this ast::Name has name designated as a
6048  * node name.
6049  *
6050  * @return name of the node as std::string
6051  *
6052  * \sa Ast::get_node_type_name
6053  */
6054 std::string get_node_name() const override;
6055 
6056 
6057  /**
6058  * \brief Getter for member variable \ref PointerVar.name
6059  */
6060  const std::shared_ptr<Name>& get_name() const noexcept {
6061  return name;
6062  }
6063 
6064 
6065 
6066  /// \}
6067 
6068  /// \name Setters
6069  /// \{
6070 
6071 
6072  /**
6073  * \brief Set token for the current ast node
6074  */
6075  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
6076 
6077 
6078 
6079 
6080  /**
6081  * \brief Setter for member variable \ref PointerVar.name (rvalue reference)
6082  */
6083  void set_name(std::shared_ptr<Name>&& name);
6084 
6085  /**
6086  * \brief Setter for member variable \ref PointerVar.name
6087  */
6088  void set_name(const std::shared_ptr<Name>& name);
6089 
6090 
6091  /// \}
6092 
6093  /// \name Visitor
6094  /// \{
6095 
6096  /**
6097  * \brief visit children i.e. member variables of current node using provided visitor
6098  *
6099  * Different nodes in the AST have different members (i.e. children). This method
6100  * recursively visits children using provided visitor.
6101  *
6102  * \param v Concrete visitor that will be used to recursively visit children
6103  *
6104  * \sa Ast::visit_children for example.
6105  */
6106  void visit_children(visitor::Visitor& v) override;
6107 
6108  /**
6109  * \brief visit children i.e. member variables of current node using provided visitor
6110  *
6111  * Different nodes in the AST have different members (i.e. children). This method
6112  * recursively visits children using provided visitor.
6113  *
6114  * \param v Concrete constant visitor that will be used to recursively visit children
6115  *
6116  * \sa Ast::visit_children for example.
6117  */
6118  void visit_children(visitor::ConstVisitor& v) const override;
6119 
6120  /**
6121  * \brief accept (or visit) the current AST node using provided visitor
6122  *
6123  * Instead of visiting children of AST node, like Ast::visit_children,
6124  * accept allows to visit the current node itself using provided concrete
6125  * visitor.
6126  *
6127  * \param v Concrete visitor that will be used to recursively visit node
6128  *
6129  * \sa Ast::accept for example.
6130  */
6131  void accept(visitor::Visitor& v) override;
6132 
6133  /**
6134  * \copydoc accept(visitor::Visitor&)
6135  */
6136  void accept(visitor::ConstVisitor& v) const override;
6137 
6138  /// \}
6139 
6140 
6141 
6142  private:
6143  /**
6144  * \brief Set this object as parent for all the children
6145  *
6146  * This should be called in every object (with children) constructor
6147  * to set parents. Since it is called only in the constructors it
6148  * should not be virtual to avoid ambiguities (issue #295).
6149  */
6150  void set_parent_in_children();
6151 };
6152 
6153 /** @} */ // end of ast_class
6154 
6155 
6156 } // namespace ast
6157 } // namespace nmodl
6158 #endif // !NMODL_AST_POINTER_VAR_HPP
6159 #ifndef NMODL_AST_BBCORE_POINTER_VAR_HPP
6160 #define NMODL_AST_BBCORE_POINTER_VAR_HPP
6161 
6162 
6163 namespace nmodl {
6164 namespace ast {
6165 
6166 /**
6167  * @addtogroup ast_class
6168  * @ingroup ast
6169  * @{
6170  */
6171 
6172 /**
6173  * \brief Represent a single variable of type BBCOREPOINTER
6174  *
6175  * See ast::BbcorePointer for an example.
6176  *
6177 */
6179  private:
6180  /// Variable name
6181  std::shared_ptr<Name> name;
6182  /// token with location information
6183  std::shared_ptr<ModToken> token;
6184 
6185  public:
6186 
6187  /// \name Ctor & dtor
6188  /// \{
6189 
6190  explicit BbcorePointerVar(Name* name);
6191  explicit BbcorePointerVar(const std::shared_ptr<Name>& name);
6192  BbcorePointerVar(const BbcorePointerVar& obj);
6193 
6194 
6195  virtual ~BbcorePointerVar() = default;
6196 
6197  /// \}
6198 
6199 
6200 
6201 
6202 
6203 
6204  /**
6205  * \brief Check if the ast node is an instance of ast::BbcorePointerVar
6206  * \return true as object is of type ast::BbcorePointerVar
6207  */
6208  bool is_bbcore_pointer_var () const noexcept override {
6209  return true;
6210  }
6211 
6212  /**
6213  * \brief Return a copy of the current node
6214  *
6215  * Recursively make a new copy/clone of the current node including
6216  * all members and return a pointer to the node. This is used for
6217  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6218  * ast.
6219  *
6220  * @return pointer to the clone/copy of the current node
6221  */
6222  BbcorePointerVar* clone() const override {
6223  return new BbcorePointerVar(*this);
6224  }
6225 
6226  /// \name Getters
6227  /// \{
6228 
6229  /**
6230  * \brief Return type (ast::AstNodeType) of ast node
6231  *
6232  * Every node in the ast has a type defined in ast::AstNodeType and this
6233  * function is used to retrieve the same.
6234  *
6235  * \return ast node type i.e. ast::AstNodeType::BBCORE_POINTER_VAR
6236  *
6237  * \sa Ast::get_node_type_name
6238  */
6239  AstNodeType get_node_type() const noexcept override {
6241  }
6242 
6243  /**
6244  * \brief Return type (ast::AstNodeType) of ast node as std::string
6245  *
6246  * Every node in the ast has a type defined in ast::AstNodeType.
6247  * This type name can be returned as a std::string for printing
6248  * node to text/json form.
6249  *
6250  * \return name of the node type as a string i.e. "BbcorePointerVar"
6251  *
6252  * \sa Ast::get_node_name
6253  */
6254  std::string get_node_type_name() const noexcept override {
6255  return "BbcorePointerVar";
6256  }
6257 
6258 
6259  /**
6260  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6261  */
6262  std::shared_ptr<Ast> get_shared_ptr() override {
6263  return std::static_pointer_cast<BbcorePointerVar>(shared_from_this());
6264  }
6265 
6266  /**
6267  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6268  */
6269  std::shared_ptr<const Ast> get_shared_ptr() const override {
6270  return std::static_pointer_cast<const BbcorePointerVar>(shared_from_this());
6271  }
6272 
6273  /**
6274  * \brief Return associated token for the current ast node
6275  *
6276  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
6277  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
6278  * nullptr to store in the nmodl::symtab::SymbolTable.
6279  *
6280  * \return pointer to token if exist otherwise nullptr
6281  */
6282  const ModToken* get_token() const noexcept override {
6283  return token.get();
6284  }
6285 
6286 
6287 
6288 
6289 
6290 
6291 /**
6292  * \brief Return name of the node
6293  *
6294  * Some ast nodes have a member marked designated as node name. For example,
6295  * in case of this ast::Name has name designated as a
6296  * node name.
6297  *
6298  * @return name of the node as std::string
6299  *
6300  * \sa Ast::get_node_type_name
6301  */
6302 std::string get_node_name() const override;
6303 
6304 
6305  /**
6306  * \brief Getter for member variable \ref BbcorePointerVar.name
6307  */
6308  const std::shared_ptr<Name>& get_name() const noexcept {
6309  return name;
6310  }
6311 
6312 
6313 
6314  /// \}
6315 
6316  /// \name Setters
6317  /// \{
6318 
6319 
6320  /**
6321  * \brief Set token for the current ast node
6322  */
6323  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
6324 
6325 
6326 
6327 
6328  /**
6329  * \brief Setter for member variable \ref BbcorePointerVar.name (rvalue reference)
6330  */
6331  void set_name(std::shared_ptr<Name>&& name);
6332 
6333  /**
6334  * \brief Setter for member variable \ref BbcorePointerVar.name
6335  */
6336  void set_name(const std::shared_ptr<Name>& name);
6337 
6338 
6339  /// \}
6340 
6341  /// \name Visitor
6342  /// \{
6343 
6344  /**
6345  * \brief visit children i.e. member variables of current node using provided visitor
6346  *
6347  * Different nodes in the AST have different members (i.e. children). This method
6348  * recursively visits children using provided visitor.
6349  *
6350  * \param v Concrete visitor that will be used to recursively visit children
6351  *
6352  * \sa Ast::visit_children for example.
6353  */
6354  void visit_children(visitor::Visitor& v) override;
6355 
6356  /**
6357  * \brief visit children i.e. member variables of current node using provided visitor
6358  *
6359  * Different nodes in the AST have different members (i.e. children). This method
6360  * recursively visits children using provided visitor.
6361  *
6362  * \param v Concrete constant visitor that will be used to recursively visit children
6363  *
6364  * \sa Ast::visit_children for example.
6365  */
6366  void visit_children(visitor::ConstVisitor& v) const override;
6367 
6368  /**
6369  * \brief accept (or visit) the current AST node using provided visitor
6370  *
6371  * Instead of visiting children of AST node, like Ast::visit_children,
6372  * accept allows to visit the current node itself using provided concrete
6373  * visitor.
6374  *
6375  * \param v Concrete visitor that will be used to recursively visit node
6376  *
6377  * \sa Ast::accept for example.
6378  */
6379  void accept(visitor::Visitor& v) override;
6380 
6381  /**
6382  * \copydoc accept(visitor::Visitor&)
6383  */
6384  void accept(visitor::ConstVisitor& v) const override;
6385 
6386  /// \}
6387 
6388 
6389 
6390  private:
6391  /**
6392  * \brief Set this object as parent for all the children
6393  *
6394  * This should be called in every object (with children) constructor
6395  * to set parents. Since it is called only in the constructors it
6396  * should not be virtual to avoid ambiguities (issue #295).
6397  */
6398  void set_parent_in_children();
6399 };
6400 
6401 /** @} */ // end of ast_class
6402 
6403 
6404 } // namespace ast
6405 } // namespace nmodl
6406 #endif // !NMODL_AST_BBCORE_POINTER_VAR_HPP
6407 #ifndef NMODL_AST_EXTERN_VAR_HPP
6408 #define NMODL_AST_EXTERN_VAR_HPP
6409 
6410 
6411 namespace nmodl {
6412 namespace ast {
6413 
6414 /**
6415  * @addtogroup ast_class
6416  * @ingroup ast
6417  * @{
6418  */
6419 
6420 /**
6421  * \brief TODO
6422  *
6423  *
6424 */
6425 class ExternVar : public Identifier {
6426  private:
6427  /// TODO
6428  std::shared_ptr<Name> name;
6429  /// token with location information
6430  std::shared_ptr<ModToken> token;
6431 
6432  public:
6433 
6434  /// \name Ctor & dtor
6435  /// \{
6436 
6437  explicit ExternVar(Name* name);
6438  explicit ExternVar(const std::shared_ptr<Name>& name);
6439  ExternVar(const ExternVar& obj);
6440 
6441 
6442  virtual ~ExternVar() = default;
6443 
6444  /// \}
6445 
6446 
6447 
6448 
6449 
6450 
6451  /**
6452  * \brief Check if the ast node is an instance of ast::ExternVar
6453  * \return true as object is of type ast::ExternVar
6454  */
6455  bool is_extern_var () const noexcept override {
6456  return true;
6457  }
6458 
6459  /**
6460  * \brief Return a copy of the current node
6461  *
6462  * Recursively make a new copy/clone of the current node including
6463  * all members and return a pointer to the node. This is used for
6464  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6465  * ast.
6466  *
6467  * @return pointer to the clone/copy of the current node
6468  */
6469  ExternVar* clone() const override {
6470  return new ExternVar(*this);
6471  }
6472 
6473  /// \name Getters
6474  /// \{
6475 
6476  /**
6477  * \brief Return type (ast::AstNodeType) of ast node
6478  *
6479  * Every node in the ast has a type defined in ast::AstNodeType and this
6480  * function is used to retrieve the same.
6481  *
6482  * \return ast node type i.e. ast::AstNodeType::EXTERN_VAR
6483  *
6484  * \sa Ast::get_node_type_name
6485  */
6486  AstNodeType get_node_type() const noexcept override {
6487  return AstNodeType::EXTERN_VAR;
6488  }
6489 
6490  /**
6491  * \brief Return type (ast::AstNodeType) of ast node as std::string
6492  *
6493  * Every node in the ast has a type defined in ast::AstNodeType.
6494  * This type name can be returned as a std::string for printing
6495  * node to text/json form.
6496  *
6497  * \return name of the node type as a string i.e. "ExternVar"
6498  *
6499  * \sa Ast::get_node_name
6500  */
6501  std::string get_node_type_name() const noexcept override {
6502  return "ExternVar";
6503  }
6504 
6505 
6506  /**
6507  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6508  */
6509  std::shared_ptr<Ast> get_shared_ptr() override {
6510  return std::static_pointer_cast<ExternVar>(shared_from_this());
6511  }
6512 
6513  /**
6514  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6515  */
6516  std::shared_ptr<const Ast> get_shared_ptr() const override {
6517  return std::static_pointer_cast<const ExternVar>(shared_from_this());
6518  }
6519 
6520  /**
6521  * \brief Return associated token for the current ast node
6522  *
6523  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
6524  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
6525  * nullptr to store in the nmodl::symtab::SymbolTable.
6526  *
6527  * \return pointer to token if exist otherwise nullptr
6528  */
6529  const ModToken* get_token() const noexcept override {
6530  return token.get();
6531  }
6532 
6533 
6534 
6535 
6536 
6537 
6538 /**
6539  * \brief Return name of the node
6540  *
6541  * Some ast nodes have a member marked designated as node name. For example,
6542  * in case of this ast::Name has name designated as a
6543  * node name.
6544  *
6545  * @return name of the node as std::string
6546  *
6547  * \sa Ast::get_node_type_name
6548  */
6549 std::string get_node_name() const override;
6550 
6551 
6552  /**
6553  * \brief Getter for member variable \ref ExternVar.name
6554  */
6555  const std::shared_ptr<Name>& get_name() const noexcept {
6556  return name;
6557  }
6558 
6559 
6560 
6561  /// \}
6562 
6563  /// \name Setters
6564  /// \{
6565 
6566 
6567  /**
6568  * \brief Set token for the current ast node
6569  */
6570  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
6571 
6572 
6573 
6574 
6575  /**
6576  * \brief Setter for member variable \ref ExternVar.name (rvalue reference)
6577  */
6578  void set_name(std::shared_ptr<Name>&& name);
6579 
6580  /**
6581  * \brief Setter for member variable \ref ExternVar.name
6582  */
6583  void set_name(const std::shared_ptr<Name>& name);
6584 
6585 
6586  /// \}
6587 
6588  /// \name Visitor
6589  /// \{
6590 
6591  /**
6592  * \brief visit children i.e. member variables of current node using provided visitor
6593  *
6594  * Different nodes in the AST have different members (i.e. children). This method
6595  * recursively visits children using provided visitor.
6596  *
6597  * \param v Concrete visitor that will be used to recursively visit children
6598  *
6599  * \sa Ast::visit_children for example.
6600  */
6601  void visit_children(visitor::Visitor& v) override;
6602 
6603  /**
6604  * \brief visit children i.e. member variables of current node using provided visitor
6605  *
6606  * Different nodes in the AST have different members (i.e. children). This method
6607  * recursively visits children using provided visitor.
6608  *
6609  * \param v Concrete constant visitor that will be used to recursively visit children
6610  *
6611  * \sa Ast::visit_children for example.
6612  */
6613  void visit_children(visitor::ConstVisitor& v) const override;
6614 
6615  /**
6616  * \brief accept (or visit) the current AST node using provided visitor
6617  *
6618  * Instead of visiting children of AST node, like Ast::visit_children,
6619  * accept allows to visit the current node itself using provided concrete
6620  * visitor.
6621  *
6622  * \param v Concrete visitor that will be used to recursively visit node
6623  *
6624  * \sa Ast::accept for example.
6625  */
6626  void accept(visitor::Visitor& v) override;
6627 
6628  /**
6629  * \copydoc accept(visitor::Visitor&)
6630  */
6631  void accept(visitor::ConstVisitor& v) const override;
6632 
6633  /// \}
6634 
6635 
6636 
6637  private:
6638  /**
6639  * \brief Set this object as parent for all the children
6640  *
6641  * This should be called in every object (with children) constructor
6642  * to set parents. Since it is called only in the constructors it
6643  * should not be virtual to avoid ambiguities (issue #295).
6644  */
6645  void set_parent_in_children();
6646 };
6647 
6648 /** @} */ // end of ast_class
6649 
6650 
6651 } // namespace ast
6652 } // namespace nmodl
6653 #endif // !NMODL_AST_EXTERN_VAR_HPP
6654 #ifndef NMODL_AST_THREADSAFE_VAR_HPP
6655 #define NMODL_AST_THREADSAFE_VAR_HPP
6656 
6657 
6658 namespace nmodl {
6659 namespace ast {
6660 
6661 /**
6662  * @addtogroup ast_class
6663  * @ingroup ast
6664  * @{
6665  */
6666 
6667 /**
6668  * \brief TODO
6669  *
6670  *
6671 */
6672 class ThreadsafeVar : public Identifier {
6673  private:
6674  /// TODO
6675  std::shared_ptr<Name> name;
6676  /// token with location information
6677  std::shared_ptr<ModToken> token;
6678 
6679  public:
6680 
6681  /// \name Ctor & dtor
6682  /// \{
6683 
6684  explicit ThreadsafeVar(Name* name);
6685  explicit ThreadsafeVar(const std::shared_ptr<Name>& name);
6686  ThreadsafeVar(const ThreadsafeVar& obj);
6687 
6688 
6689  virtual ~ThreadsafeVar() = default;
6690 
6691  /// \}
6692 
6693 
6694 
6695 
6696 
6697 
6698  /**
6699  * \brief Check if the ast node is an instance of ast::ThreadsafeVar
6700  * \return true as object is of type ast::ThreadsafeVar
6701  */
6702  bool is_threadsafe_var () const noexcept override {
6703  return true;
6704  }
6705 
6706  /**
6707  * \brief Return a copy of the current node
6708  *
6709  * Recursively make a new copy/clone of the current node including
6710  * all members and return a pointer to the node. This is used for
6711  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6712  * ast.
6713  *
6714  * @return pointer to the clone/copy of the current node
6715  */
6716  ThreadsafeVar* clone() const override {
6717  return new ThreadsafeVar(*this);
6718  }
6719 
6720  /// \name Getters
6721  /// \{
6722 
6723  /**
6724  * \brief Return type (ast::AstNodeType) of ast node
6725  *
6726  * Every node in the ast has a type defined in ast::AstNodeType and this
6727  * function is used to retrieve the same.
6728  *
6729  * \return ast node type i.e. ast::AstNodeType::THREADSAFE_VAR
6730  *
6731  * \sa Ast::get_node_type_name
6732  */
6733  AstNodeType get_node_type() const noexcept override {
6735  }
6736 
6737  /**
6738  * \brief Return type (ast::AstNodeType) of ast node as std::string
6739  *
6740  * Every node in the ast has a type defined in ast::AstNodeType.
6741  * This type name can be returned as a std::string for printing
6742  * node to text/json form.
6743  *
6744  * \return name of the node type as a string i.e. "ThreadsafeVar"
6745  *
6746  * \sa Ast::get_node_name
6747  */
6748  std::string get_node_type_name() const noexcept override {
6749  return "ThreadsafeVar";
6750  }
6751 
6752 
6753  /**
6754  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6755  */
6756  std::shared_ptr<Ast> get_shared_ptr() override {
6757  return std::static_pointer_cast<ThreadsafeVar>(shared_from_this());
6758  }
6759 
6760  /**
6761  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6762  */
6763  std::shared_ptr<const Ast> get_shared_ptr() const override {
6764  return std::static_pointer_cast<const ThreadsafeVar>(shared_from_this());
6765  }
6766 
6767  /**
6768  * \brief Return associated token for the current ast node
6769  *
6770  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
6771  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
6772  * nullptr to store in the nmodl::symtab::SymbolTable.
6773  *
6774  * \return pointer to token if exist otherwise nullptr
6775  */
6776  const ModToken* get_token() const noexcept override {
6777  return token.get();
6778  }
6779 
6780 
6781 
6782 
6783 
6784 
6785 /**
6786  * \brief Return name of the node
6787  *
6788  * Some ast nodes have a member marked designated as node name. For example,
6789  * in case of this ast::Name has name designated as a
6790  * node name.
6791  *
6792  * @return name of the node as std::string
6793  *
6794  * \sa Ast::get_node_type_name
6795  */
6796 std::string get_node_name() const override;
6797 
6798 
6799  /**
6800  * \brief Getter for member variable \ref ThreadsafeVar.name
6801  */
6802  const std::shared_ptr<Name>& get_name() const noexcept {
6803  return name;
6804  }
6805 
6806 
6807 
6808  /// \}
6809 
6810  /// \name Setters
6811  /// \{
6812 
6813 
6814  /**
6815  * \brief Set token for the current ast node
6816  */
6817  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
6818 
6819 
6820 
6821 
6822  /**
6823  * \brief Setter for member variable \ref ThreadsafeVar.name (rvalue reference)
6824  */
6825  void set_name(std::shared_ptr<Name>&& name);
6826 
6827  /**
6828  * \brief Setter for member variable \ref ThreadsafeVar.name
6829  */
6830  void set_name(const std::shared_ptr<Name>& name);
6831 
6832 
6833  /// \}
6834 
6835  /// \name Visitor
6836  /// \{
6837 
6838  /**
6839  * \brief visit children i.e. member variables of current node using provided visitor
6840  *
6841  * Different nodes in the AST have different members (i.e. children). This method
6842  * recursively visits children using provided visitor.
6843  *
6844  * \param v Concrete visitor that will be used to recursively visit children
6845  *
6846  * \sa Ast::visit_children for example.
6847  */
6848  void visit_children(visitor::Visitor& v) override;
6849 
6850  /**
6851  * \brief visit children i.e. member variables of current node using provided visitor
6852  *
6853  * Different nodes in the AST have different members (i.e. children). This method
6854  * recursively visits children using provided visitor.
6855  *
6856  * \param v Concrete constant visitor that will be used to recursively visit children
6857  *
6858  * \sa Ast::visit_children for example.
6859  */
6860  void visit_children(visitor::ConstVisitor& v) const override;
6861 
6862  /**
6863  * \brief accept (or visit) the current AST node using provided visitor
6864  *
6865  * Instead of visiting children of AST node, like Ast::visit_children,
6866  * accept allows to visit the current node itself using provided concrete
6867  * visitor.
6868  *
6869  * \param v Concrete visitor that will be used to recursively visit node
6870  *
6871  * \sa Ast::accept for example.
6872  */
6873  void accept(visitor::Visitor& v) override;
6874 
6875  /**
6876  * \copydoc accept(visitor::Visitor&)
6877  */
6878  void accept(visitor::ConstVisitor& v) const override;
6879 
6880  /// \}
6881 
6882 
6883 
6884  private:
6885  /**
6886  * \brief Set this object as parent for all the children
6887  *
6888  * This should be called in every object (with children) constructor
6889  * to set parents. Since it is called only in the constructors it
6890  * should not be virtual to avoid ambiguities (issue #295).
6891  */
6892  void set_parent_in_children();
6893 };
6894 
6895 /** @} */ // end of ast_class
6896 
6897 
6898 } // namespace ast
6899 } // namespace nmodl
6900 #endif // !NMODL_AST_THREADSAFE_VAR_HPP
6901 #ifndef NMODL_AST_PARAM_BLOCK_HPP
6902 #define NMODL_AST_PARAM_BLOCK_HPP
6903 
6904 
6905 namespace nmodl {
6906 namespace ast {
6907 
6908 /**
6909  * @addtogroup ast_class
6910  * @ingroup ast
6911  * @{
6912  */
6913 
6914 /**
6915  * \brief Represents a `PARAMETER` block in the NMODL
6916  *
6917  * Variables whose values are normally specified by the user are parameters
6918  * and are declared in a `PARAMETER` block. Here is an example :
6919  *
6920  * \code{.mod}
6921  * PARAMETER {
6922  * gkbar=.01 (mho/cm2) : Maximum Permeability
6923  * d1 = .84
6924  * k2 = .13e-6 (mM)
6925  * abar = .28 (/ms)
6926  * lcai (mV)
6927  * }
6928  * \endcode
6929  *
6930  * All parameters are stored in the ast::ParamBlock::statements as vector.
6931  *
6932 */
6933 class ParamBlock : public Block {
6934  private:
6935  /// Vector of parameters
6937  /// token with location information
6938  std::shared_ptr<ModToken> token;
6939  /// symbol table for a block
6940  symtab::SymbolTable* symtab = nullptr;
6941 
6942  public:
6943 
6944  /// \name Ctor & dtor
6945  /// \{
6946 
6947  explicit ParamBlock(ParamAssignVector statements);
6948  ParamBlock(const ParamBlock& obj);
6949 
6950 
6951  virtual ~ParamBlock() = default;
6952 
6953  /// \}
6954 
6955 
6956 
6957 
6958 
6959 
6960  /**
6961  * \brief Check if the ast node is an instance of ast::ParamBlock
6962  * \return true as object is of type ast::ParamBlock
6963  */
6964  bool is_param_block () const noexcept override {
6965  return true;
6966  }
6967 
6968  /**
6969  * \brief Return a copy of the current node
6970  *
6971  * Recursively make a new copy/clone of the current node including
6972  * all members and return a pointer to the node. This is used for
6973  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6974  * ast.
6975  *
6976  * @return pointer to the clone/copy of the current node
6977  */
6978  ParamBlock* clone() const override {
6979  return new ParamBlock(*this);
6980  }
6981 
6982  /// \name Getters
6983  /// \{
6984 
6985  /**
6986  * \brief Return type (ast::AstNodeType) of ast node
6987  *
6988  * Every node in the ast has a type defined in ast::AstNodeType and this
6989  * function is used to retrieve the same.
6990  *
6991  * \return ast node type i.e. ast::AstNodeType::PARAM_BLOCK
6992  *
6993  * \sa Ast::get_node_type_name
6994  */
6995  AstNodeType get_node_type() const noexcept override {
6996  return AstNodeType::PARAM_BLOCK;
6997  }
6998 
6999  /**
7000  * \brief Return type (ast::AstNodeType) of ast node as std::string
7001  *
7002  * Every node in the ast has a type defined in ast::AstNodeType.
7003  * This type name can be returned as a std::string for printing
7004  * node to text/json form.
7005  *
7006  * \return name of the node type as a string i.e. "ParamBlock"
7007  *
7008  * \sa Ast::get_node_name
7009  */
7010  std::string get_node_type_name() const noexcept override {
7011  return "ParamBlock";
7012  }
7013 
7014  /**
7015  * \brief Return NMODL statement of ast node as std::string
7016  *
7017  * Every node is related to a special statement in the NMODL. This
7018  * statement can be returned as a std::string for printing to
7019  * text/json form.
7020  *
7021  * \return name of the statement as a string i.e. "PARAMETER "
7022  *
7023  * \sa Ast::get_nmodl_name
7024  */
7025  std::string get_nmodl_name() const noexcept override {
7026  return "PARAMETER ";
7027  }
7028 
7029  /**
7030  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7031  */
7032  std::shared_ptr<Ast> get_shared_ptr() override {
7033  return std::static_pointer_cast<ParamBlock>(shared_from_this());
7034  }
7035 
7036  /**
7037  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7038  */
7039  std::shared_ptr<const Ast> get_shared_ptr() const override {
7040  return std::static_pointer_cast<const ParamBlock>(shared_from_this());
7041  }
7042 
7043  /**
7044  * \brief Return associated token for the current ast node
7045  *
7046  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
7047  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
7048  * nullptr to store in the nmodl::symtab::SymbolTable.
7049  *
7050  * \return pointer to token if exist otherwise nullptr
7051  */
7052  const ModToken* get_token() const noexcept override {
7053  return token.get();
7054  }
7055 
7056  /**
7057  * \brief Return associated symbol table for the current ast node
7058  *
7059  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7060  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7061  * and it can be accessed using this method.
7062  *
7063  * \return pointer to the symbol table
7064  *
7065  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7066  */
7068  return symtab;
7069  }
7070 
7071 
7072 
7073 
7074 
7075 
7076 
7077 
7078  /**
7079  * \brief Getter for member variable \ref ParamBlock.statements
7080  */
7081  const ParamAssignVector& get_statements() const noexcept {
7082  return statements;
7083  }
7084 
7085 
7086 
7087  /// \}
7088 
7089  /// \name Setters
7090  /// \{
7091 
7092 
7093  /**
7094  * \brief Set token for the current ast node
7095  */
7096  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
7097 
7098  /**
7099  * \brief Set symbol table for the current ast node
7100  *
7101  * Top level, block scoped nodes store symbol table in the ast node.
7102  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7103  * for every node in the ast.
7104  *
7105  * \sa nmodl::visitor::SymtabVisitor
7106  */
7107  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
7108  symtab = newsymtab;
7109  }
7110 
7111 
7112 
7113  /**
7114  * \brief Setter for member variable \ref ParamBlock.statements (rvalue reference)
7115  */
7116  void set_statements(ParamAssignVector&& statements);
7117 
7118  /**
7119  * \brief Setter for member variable \ref ParamBlock.statements
7120  */
7121  void set_statements(const ParamAssignVector& statements);
7122 
7123 
7124  /// \}
7125 
7126  /// \name Visitor
7127  /// \{
7128 
7129  /**
7130  * \brief visit children i.e. member variables of current node using provided visitor
7131  *
7132  * Different nodes in the AST have different members (i.e. children). This method
7133  * recursively visits children using provided visitor.
7134  *
7135  * \param v Concrete visitor that will be used to recursively visit children
7136  *
7137  * \sa Ast::visit_children for example.
7138  */
7139  void visit_children(visitor::Visitor& v) override;
7140 
7141  /**
7142  * \brief visit children i.e. member variables of current node using provided visitor
7143  *
7144  * Different nodes in the AST have different members (i.e. children). This method
7145  * recursively visits children using provided visitor.
7146  *
7147  * \param v Concrete constant visitor that will be used to recursively visit children
7148  *
7149  * \sa Ast::visit_children for example.
7150  */
7151  void visit_children(visitor::ConstVisitor& v) const override;
7152 
7153  /**
7154  * \brief accept (or visit) the current AST node using provided visitor
7155  *
7156  * Instead of visiting children of AST node, like Ast::visit_children,
7157  * accept allows to visit the current node itself using provided concrete
7158  * visitor.
7159  *
7160  * \param v Concrete visitor that will be used to recursively visit node
7161  *
7162  * \sa Ast::accept for example.
7163  */
7164  void accept(visitor::Visitor& v) override;
7165 
7166  /**
7167  * \copydoc accept(visitor::Visitor&)
7168  */
7169  void accept(visitor::ConstVisitor& v) const override;
7170 
7171  /// \}
7172 
7173 
7174 
7175  private:
7176  /**
7177  * \brief Set this object as parent for all the children
7178  *
7179  * This should be called in every object (with children) constructor
7180  * to set parents. Since it is called only in the constructors it
7181  * should not be virtual to avoid ambiguities (issue #295).
7182  */
7183  void set_parent_in_children();
7184 };
7185 
7186 /** @} */ // end of ast_class
7187 
7188 
7189 } // namespace ast
7190 } // namespace nmodl
7191 #endif // !NMODL_AST_PARAM_BLOCK_HPP
7192 #ifndef NMODL_AST_STEP_BLOCK_HPP
7193 #define NMODL_AST_STEP_BLOCK_HPP
7194 
7195 
7196 namespace nmodl {
7197 namespace ast {
7198 
7199 /**
7200  * @addtogroup ast_class
7201  * @ingroup ast
7202  * @{
7203  */
7204 
7205 /**
7206  * \brief Represents a `STEPPED` block in the NMODL
7207  *
7208  * `STEPPED` has following form in the NMODL specification :
7209  *
7210  * \code{.mod}
7211  * STEPPED {
7212  * name1 = number1 (mM)
7213  * name2 = number2, number3
7214  * }
7215  * \endcode
7216  *
7217  * \todo Check ModelDB and other databse for example of channel.
7218  *
7219 */
7220 class StepBlock : public Block {
7221  private:
7222  /// Vector of statements
7224  /// token with location information
7225  std::shared_ptr<ModToken> token;
7226  /// symbol table for a block
7227  symtab::SymbolTable* symtab = nullptr;
7228 
7229  public:
7230 
7231  /// \name Ctor & dtor
7232  /// \{
7233 
7234  explicit StepBlock(SteppedVector statements);
7235  StepBlock(const StepBlock& obj);
7236 
7237 
7238  virtual ~StepBlock() = default;
7239 
7240  /// \}
7241 
7242 
7243 
7244 
7245 
7246 
7247  /**
7248  * \brief Check if the ast node is an instance of ast::StepBlock
7249  * \return true as object is of type ast::StepBlock
7250  */
7251  bool is_step_block () const noexcept override {
7252  return true;
7253  }
7254 
7255  /**
7256  * \brief Return a copy of the current node
7257  *
7258  * Recursively make a new copy/clone of the current node including
7259  * all members and return a pointer to the node. This is used for
7260  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7261  * ast.
7262  *
7263  * @return pointer to the clone/copy of the current node
7264  */
7265  StepBlock* clone() const override {
7266  return new StepBlock(*this);
7267  }
7268 
7269  /// \name Getters
7270  /// \{
7271 
7272  /**
7273  * \brief Return type (ast::AstNodeType) of ast node
7274  *
7275  * Every node in the ast has a type defined in ast::AstNodeType and this
7276  * function is used to retrieve the same.
7277  *
7278  * \return ast node type i.e. ast::AstNodeType::STEP_BLOCK
7279  *
7280  * \sa Ast::get_node_type_name
7281  */
7282  AstNodeType get_node_type() const noexcept override {
7283  return AstNodeType::STEP_BLOCK;
7284  }
7285 
7286  /**
7287  * \brief Return type (ast::AstNodeType) of ast node as std::string
7288  *
7289  * Every node in the ast has a type defined in ast::AstNodeType.
7290  * This type name can be returned as a std::string for printing
7291  * node to text/json form.
7292  *
7293  * \return name of the node type as a string i.e. "StepBlock"
7294  *
7295  * \sa Ast::get_node_name
7296  */
7297  std::string get_node_type_name() const noexcept override {
7298  return "StepBlock";
7299  }
7300 
7301  /**
7302  * \brief Return NMODL statement of ast node as std::string
7303  *
7304  * Every node is related to a special statement in the NMODL. This
7305  * statement can be returned as a std::string for printing to
7306  * text/json form.
7307  *
7308  * \return name of the statement as a string i.e. "STEPPED "
7309  *
7310  * \sa Ast::get_nmodl_name
7311  */
7312  std::string get_nmodl_name() const noexcept override {
7313  return "STEPPED ";
7314  }
7315 
7316  /**
7317  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7318  */
7319  std::shared_ptr<Ast> get_shared_ptr() override {
7320  return std::static_pointer_cast<StepBlock>(shared_from_this());
7321  }
7322 
7323  /**
7324  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7325  */
7326  std::shared_ptr<const Ast> get_shared_ptr() const override {
7327  return std::static_pointer_cast<const StepBlock>(shared_from_this());
7328  }
7329 
7330  /**
7331  * \brief Return associated token for the current ast node
7332  *
7333  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
7334  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
7335  * nullptr to store in the nmodl::symtab::SymbolTable.
7336  *
7337  * \return pointer to token if exist otherwise nullptr
7338  */
7339  const ModToken* get_token() const noexcept override {
7340  return token.get();
7341  }
7342 
7343  /**
7344  * \brief Return associated symbol table for the current ast node
7345  *
7346  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7347  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7348  * and it can be accessed using this method.
7349  *
7350  * \return pointer to the symbol table
7351  *
7352  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7353  */
7355  return symtab;
7356  }
7357 
7358 
7359 
7360 
7361 
7362 
7363 
7364 
7365  /**
7366  * \brief Getter for member variable \ref StepBlock.statements
7367  */
7368  const SteppedVector& get_statements() const noexcept {
7369  return statements;
7370  }
7371 
7372 
7373 
7374  /// \}
7375 
7376  /// \name Setters
7377  /// \{
7378 
7379 
7380  /**
7381  * \brief Set token for the current ast node
7382  */
7383  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
7384 
7385  /**
7386  * \brief Set symbol table for the current ast node
7387  *
7388  * Top level, block scoped nodes store symbol table in the ast node.
7389  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7390  * for every node in the ast.
7391  *
7392  * \sa nmodl::visitor::SymtabVisitor
7393  */
7394  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
7395  symtab = newsymtab;
7396  }
7397 
7398 
7399 
7400  /**
7401  * \brief Setter for member variable \ref StepBlock.statements (rvalue reference)
7402  */
7403  void set_statements(SteppedVector&& statements);
7404 
7405  /**
7406  * \brief Setter for member variable \ref StepBlock.statements
7407  */
7408  void set_statements(const SteppedVector& statements);
7409 
7410 
7411  /// \}
7412 
7413  /// \name Visitor
7414  /// \{
7415 
7416  /**
7417  * \brief visit children i.e. member variables of current node using provided visitor
7418  *
7419  * Different nodes in the AST have different members (i.e. children). This method
7420  * recursively visits children using provided visitor.
7421  *
7422  * \param v Concrete visitor that will be used to recursively visit children
7423  *
7424  * \sa Ast::visit_children for example.
7425  */
7426  void visit_children(visitor::Visitor& v) override;
7427 
7428  /**
7429  * \brief visit children i.e. member variables of current node using provided visitor
7430  *
7431  * Different nodes in the AST have different members (i.e. children). This method
7432  * recursively visits children using provided visitor.
7433  *
7434  * \param v Concrete constant visitor that will be used to recursively visit children
7435  *
7436  * \sa Ast::visit_children for example.
7437  */
7438  void visit_children(visitor::ConstVisitor& v) const override;
7439 
7440  /**
7441  * \brief accept (or visit) the current AST node using provided visitor
7442  *
7443  * Instead of visiting children of AST node, like Ast::visit_children,
7444  * accept allows to visit the current node itself using provided concrete
7445  * visitor.
7446  *
7447  * \param v Concrete visitor that will be used to recursively visit node
7448  *
7449  * \sa Ast::accept for example.
7450  */
7451  void accept(visitor::Visitor& v) override;
7452 
7453  /**
7454  * \copydoc accept(visitor::Visitor&)
7455  */
7456  void accept(visitor::ConstVisitor& v) const override;
7457 
7458  /// \}
7459 
7460 
7461 
7462  private:
7463  /**
7464  * \brief Set this object as parent for all the children
7465  *
7466  * This should be called in every object (with children) constructor
7467  * to set parents. Since it is called only in the constructors it
7468  * should not be virtual to avoid ambiguities (issue #295).
7469  */
7470  void set_parent_in_children();
7471 };
7472 
7473 /** @} */ // end of ast_class
7474 
7475 
7476 } // namespace ast
7477 } // namespace nmodl
7478 #endif // !NMODL_AST_STEP_BLOCK_HPP
7479 #ifndef NMODL_AST_INDEPENDENT_BLOCK_HPP
7480 #define NMODL_AST_INDEPENDENT_BLOCK_HPP
7481 
7482 
7483 namespace nmodl {
7484 namespace ast {
7485 
7486 /**
7487  * @addtogroup ast_class
7488  * @ingroup ast
7489  * @{
7490  */
7491 
7492 /**
7493  * \brief Represents a `INDEPENDENT` block in the NMODL
7494  *
7495  * `INDEPENDENT` has following form in the NMODL specification :
7496  *
7497  * \code{.mod}
7498  * INDEPENDENT {
7499  * t FROM 0 TO 1 WITH 1 (ms)
7500  * }
7501  * \endcode
7502  *
7503 */
7504 class IndependentBlock : public Block {
7505  private:
7506  /// TODO
7508  /// token with location information
7509  std::shared_ptr<ModToken> token;
7510  /// symbol table for a block
7511  symtab::SymbolTable* symtab = nullptr;
7512 
7513  public:
7514 
7515  /// \name Ctor & dtor
7516  /// \{
7517 
7518  explicit IndependentBlock(IndependentDefinitionVector definitions);
7519  IndependentBlock(const IndependentBlock& obj);
7520 
7521 
7522  virtual ~IndependentBlock() = default;
7523 
7524  /// \}
7525 
7526 
7527 
7528 
7529 
7530 
7531  /**
7532  * \brief Check if the ast node is an instance of ast::IndependentBlock
7533  * \return true as object is of type ast::IndependentBlock
7534  */
7535  bool is_independent_block () const noexcept override {
7536  return true;
7537  }
7538 
7539  /**
7540  * \brief Return a copy of the current node
7541  *
7542  * Recursively make a new copy/clone of the current node including
7543  * all members and return a pointer to the node. This is used for
7544  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7545  * ast.
7546  *
7547  * @return pointer to the clone/copy of the current node
7548  */
7549  IndependentBlock* clone() const override {
7550  return new IndependentBlock(*this);
7551  }
7552 
7553  /// \name Getters
7554  /// \{
7555 
7556  /**
7557  * \brief Return type (ast::AstNodeType) of ast node
7558  *
7559  * Every node in the ast has a type defined in ast::AstNodeType and this
7560  * function is used to retrieve the same.
7561  *
7562  * \return ast node type i.e. ast::AstNodeType::INDEPENDENT_BLOCK
7563  *
7564  * \sa Ast::get_node_type_name
7565  */
7566  AstNodeType get_node_type() const noexcept override {
7568  }
7569 
7570  /**
7571  * \brief Return type (ast::AstNodeType) of ast node as std::string
7572  *
7573  * Every node in the ast has a type defined in ast::AstNodeType.
7574  * This type name can be returned as a std::string for printing
7575  * node to text/json form.
7576  *
7577  * \return name of the node type as a string i.e. "IndependentBlock"
7578  *
7579  * \sa Ast::get_node_name
7580  */
7581  std::string get_node_type_name() const noexcept override {
7582  return "IndependentBlock";
7583  }
7584 
7585  /**
7586  * \brief Return NMODL statement of ast node as std::string
7587  *
7588  * Every node is related to a special statement in the NMODL. This
7589  * statement can be returned as a std::string for printing to
7590  * text/json form.
7591  *
7592  * \return name of the statement as a string i.e. "INDEPENDENT "
7593  *
7594  * \sa Ast::get_nmodl_name
7595  */
7596  std::string get_nmodl_name() const noexcept override {
7597  return "INDEPENDENT ";
7598  }
7599 
7600  /**
7601  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7602  */
7603  std::shared_ptr<Ast> get_shared_ptr() override {
7604  return std::static_pointer_cast<IndependentBlock>(shared_from_this());
7605  }
7606 
7607  /**
7608  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7609  */
7610  std::shared_ptr<const Ast> get_shared_ptr() const override {
7611  return std::static_pointer_cast<const IndependentBlock>(shared_from_this());
7612  }
7613 
7614  /**
7615  * \brief Return associated token for the current ast node
7616  *
7617  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
7618  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
7619  * nullptr to store in the nmodl::symtab::SymbolTable.
7620  *
7621  * \return pointer to token if exist otherwise nullptr
7622  */
7623  const ModToken* get_token() const noexcept override {
7624  return token.get();
7625  }
7626 
7627  /**
7628  * \brief Return associated symbol table for the current ast node
7629  *
7630  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7631  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7632  * and it can be accessed using this method.
7633  *
7634  * \return pointer to the symbol table
7635  *
7636  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7637  */
7639  return symtab;
7640  }
7641 
7642 
7643 
7644 
7645 
7646 
7647 
7648 
7649  /**
7650  * \brief Getter for member variable \ref IndependentBlock.definitions
7651  */
7653  return definitions;
7654  }
7655 
7656 
7657 
7658  /// \}
7659 
7660  /// \name Setters
7661  /// \{
7662 
7663 
7664  /**
7665  * \brief Set token for the current ast node
7666  */
7667  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
7668 
7669  /**
7670  * \brief Set symbol table for the current ast node
7671  *
7672  * Top level, block scoped nodes store symbol table in the ast node.
7673  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7674  * for every node in the ast.
7675  *
7676  * \sa nmodl::visitor::SymtabVisitor
7677  */
7678  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
7679  symtab = newsymtab;
7680  }
7681 
7682 
7683 
7684  /**
7685  * \brief Setter for member variable \ref IndependentBlock.definitions (rvalue reference)
7686  */
7687  void set_definitions(IndependentDefinitionVector&& definitions);
7688 
7689  /**
7690  * \brief Setter for member variable \ref IndependentBlock.definitions
7691  */
7692  void set_definitions(const IndependentDefinitionVector& definitions);
7693 
7694 
7695  /// \}
7696 
7697  /// \name Visitor
7698  /// \{
7699 
7700  /**
7701  * \brief visit children i.e. member variables of current node using provided visitor
7702  *
7703  * Different nodes in the AST have different members (i.e. children). This method
7704  * recursively visits children using provided visitor.
7705  *
7706  * \param v Concrete visitor that will be used to recursively visit children
7707  *
7708  * \sa Ast::visit_children for example.
7709  */
7710  void visit_children(visitor::Visitor& v) override;
7711 
7712  /**
7713  * \brief visit children i.e. member variables of current node using provided visitor
7714  *
7715  * Different nodes in the AST have different members (i.e. children). This method
7716  * recursively visits children using provided visitor.
7717  *
7718  * \param v Concrete constant visitor that will be used to recursively visit children
7719  *
7720  * \sa Ast::visit_children for example.
7721  */
7722  void visit_children(visitor::ConstVisitor& v) const override;
7723 
7724  /**
7725  * \brief accept (or visit) the current AST node using provided visitor
7726  *
7727  * Instead of visiting children of AST node, like Ast::visit_children,
7728  * accept allows to visit the current node itself using provided concrete
7729  * visitor.
7730  *
7731  * \param v Concrete visitor that will be used to recursively visit node
7732  *
7733  * \sa Ast::accept for example.
7734  */
7735  void accept(visitor::Visitor& v) override;
7736 
7737  /**
7738  * \copydoc accept(visitor::Visitor&)
7739  */
7740  void accept(visitor::ConstVisitor& v) const override;
7741 
7742  /// \}
7743 
7744 
7745 
7746  private:
7747  /**
7748  * \brief Set this object as parent for all the children
7749  *
7750  * This should be called in every object (with children) constructor
7751  * to set parents. Since it is called only in the constructors it
7752  * should not be virtual to avoid ambiguities (issue #295).
7753  */
7754  void set_parent_in_children();
7755 };
7756 
7757 /** @} */ // end of ast_class
7758 
7759 
7760 } // namespace ast
7761 } // namespace nmodl
7762 #endif // !NMODL_AST_INDEPENDENT_BLOCK_HPP
7763 #ifndef NMODL_AST_ASSIGNED_BLOCK_HPP
7764 #define NMODL_AST_ASSIGNED_BLOCK_HPP
7765 #define NMODL_AST_ASSIGNED_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
7766 
7767 
7768 namespace nmodl {
7769 namespace ast {
7770 
7771 /**
7772  * @addtogroup ast_class
7773  * @ingroup ast
7774  * @{
7775  */
7776 
7777 /**
7778  * \brief Represents a `ASSIGNED` block in the NMODL
7779  *
7780  * The `ASSIGNED` block is used for declaring two kinds of variables :
7781  * - those that are given values outside the mod files
7782  * - those that appear on the left hand side of assignment statements within
7783  * the mod file
7784  *
7785  * Below is an example of `ASSIGNED` block in the mod file:
7786  *
7787  * \code{.mod}
7788  * ASSIGNED {
7789  * ina (mA/cm2)
7790  * gna (pS/um2)
7791  * mtau (ms) htau (ms)
7792  * tadj
7793  * }
7794  * \endcode
7795  *
7796 */
7797 class AssignedBlock : public Block {
7798  private:
7799  /// Vector of assigned variables
7801  /// token with location information
7802  std::shared_ptr<ModToken> token;
7803  /// symbol table for a block
7804  symtab::SymbolTable* symtab = nullptr;
7805 
7806  public:
7807 
7808  /// \name Ctor & dtor
7809  /// \{
7810 
7811  explicit AssignedBlock(AssignedDefinitionVector definitions);
7812  AssignedBlock(const AssignedBlock& obj);
7813 
7814 
7815  virtual ~AssignedBlock() = default;
7816 
7817  /// \}
7818 
7819 
7820 
7821 
7822 
7823 
7824  /**
7825  * \brief Check if the ast node is an instance of ast::AssignedBlock
7826  * \return true as object is of type ast::AssignedBlock
7827  */
7828  bool is_assigned_block () const noexcept override {
7829  return true;
7830  }
7831 
7832  /**
7833  * \brief Return a copy of the current node
7834  *
7835  * Recursively make a new copy/clone of the current node including
7836  * all members and return a pointer to the node. This is used for
7837  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7838  * ast.
7839  *
7840  * @return pointer to the clone/copy of the current node
7841  */
7842  AssignedBlock* clone() const override {
7843  return new AssignedBlock(*this);
7844  }
7845 
7846  /// \name Getters
7847  /// \{
7848 
7849  /**
7850  * \brief Return type (ast::AstNodeType) of ast node
7851  *
7852  * Every node in the ast has a type defined in ast::AstNodeType and this
7853  * function is used to retrieve the same.
7854  *
7855  * \return ast node type i.e. ast::AstNodeType::ASSIGNED_BLOCK
7856  *
7857  * \sa Ast::get_node_type_name
7858  */
7859  AstNodeType get_node_type() const noexcept override {
7861  }
7862 
7863  /**
7864  * \brief Return type (ast::AstNodeType) of ast node as std::string
7865  *
7866  * Every node in the ast has a type defined in ast::AstNodeType.
7867  * This type name can be returned as a std::string for printing
7868  * node to text/json form.
7869  *
7870  * \return name of the node type as a string i.e. "AssignedBlock"
7871  *
7872  * \sa Ast::get_node_name
7873  */
7874  std::string get_node_type_name() const noexcept override {
7875  return "AssignedBlock";
7876  }
7877 
7878  /**
7879  * \brief Return NMODL statement of ast node as std::string
7880  *
7881  * Every node is related to a special statement in the NMODL. This
7882  * statement can be returned as a std::string for printing to
7883  * text/json form.
7884  *
7885  * \return name of the statement as a string i.e. "ASSIGNED "
7886  *
7887  * \sa Ast::get_nmodl_name
7888  */
7889  std::string get_nmodl_name() const noexcept override {
7890  return "ASSIGNED ";
7891  }
7892 
7893  /**
7894  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7895  */
7896  std::shared_ptr<Ast> get_shared_ptr() override {
7897  return std::static_pointer_cast<AssignedBlock>(shared_from_this());
7898  }
7899 
7900  /**
7901  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7902  */
7903  std::shared_ptr<const Ast> get_shared_ptr() const override {
7904  return std::static_pointer_cast<const AssignedBlock>(shared_from_this());
7905  }
7906 
7907  /**
7908  * \brief Return associated token for the current ast node
7909  *
7910  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
7911  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
7912  * nullptr to store in the nmodl::symtab::SymbolTable.
7913  *
7914  * \return pointer to token if exist otherwise nullptr
7915  */
7916  const ModToken* get_token() const noexcept override {
7917  return token.get();
7918  }
7919 
7920  /**
7921  * \brief Return associated symbol table for the current ast node
7922  *
7923  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7924  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7925  * and it can be accessed using this method.
7926  *
7927  * \return pointer to the symbol table
7928  *
7929  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7930  */
7932  return symtab;
7933  }
7934 
7935 
7936 
7937 
7938 /**
7939  * \brief Add member to definitions by raw pointer
7940  */
7941 void emplace_back_assigned_definition(AssignedDefinition *n);
7942 
7943 /**
7944  * \brief Add member to definitions by shared_ptr
7945  */
7946 void emplace_back_assigned_definition(std::shared_ptr<AssignedDefinition> n);
7947 
7948 /**
7949  * \brief Erase member to definitions
7950  */
7951 AssignedDefinitionVector::const_iterator erase_assigned_definition(AssignedDefinitionVector::const_iterator first);
7952 
7953 /**
7954  * \brief Erase members to definitions
7955  */
7956 AssignedDefinitionVector::const_iterator erase_assigned_definition(AssignedDefinitionVector::const_iterator first, AssignedDefinitionVector::const_iterator last);
7957 
7958 /**
7959  * \brief Erase non-consecutive members to definitions
7960  *
7961  * loosely following the cpp reference of remove_if
7962  */
7963 size_t erase_assigned_definition(std::unordered_set<AssignedDefinition*>& to_be_erased);
7964 
7965 /**
7966  * \brief Insert member to definitions
7967  */
7968 AssignedDefinitionVector::const_iterator insert_assigned_definition(AssignedDefinitionVector::const_iterator position, const std::shared_ptr<AssignedDefinition>& n);
7969 
7970 /**
7971  * \brief Insert members to definitions
7972  */
7973 template <class NodeType, class InputIterator>
7974 void insert_assigned_definition(AssignedDefinitionVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last);
7975 
7976 /**
7977  * \brief Reset member to definitions
7978  */
7979 void reset_assigned_definition(AssignedDefinitionVector::const_iterator position, AssignedDefinition* n);
7980 
7981 /**
7982  * \brief Reset member to definitions
7983  */
7984 void reset_assigned_definition(AssignedDefinitionVector::const_iterator position, std::shared_ptr<AssignedDefinition> n);
7985 
7986 
7987 
7988 
7989 
7990  /**
7991  * \brief Getter for member variable \ref AssignedBlock.definitions
7992  */
7993  const AssignedDefinitionVector& get_definitions() const noexcept {
7994  return definitions;
7995  }
7996 
7997 
7998 
7999  /// \}
8000 
8001  /// \name Setters
8002  /// \{
8003 
8004 
8005  /**
8006  * \brief Set token for the current ast node
8007  */
8008  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
8009 
8010  /**
8011  * \brief Set symbol table for the current ast node
8012  *
8013  * Top level, block scoped nodes store symbol table in the ast node.
8014  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8015  * for every node in the ast.
8016  *
8017  * \sa nmodl::visitor::SymtabVisitor
8018  */
8019  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
8020  symtab = newsymtab;
8021  }
8022 
8023 
8024 
8025  /**
8026  * \brief Setter for member variable \ref AssignedBlock.definitions (rvalue reference)
8027  */
8028  void set_definitions(AssignedDefinitionVector&& definitions);
8029 
8030  /**
8031  * \brief Setter for member variable \ref AssignedBlock.definitions
8032  */
8033  void set_definitions(const AssignedDefinitionVector& definitions);
8034 
8035 
8036  /// \}
8037 
8038  /// \name Visitor
8039  /// \{
8040 
8041  /**
8042  * \brief visit children i.e. member variables of current node using provided visitor
8043  *
8044  * Different nodes in the AST have different members (i.e. children). This method
8045  * recursively visits children using provided visitor.
8046  *
8047  * \param v Concrete visitor that will be used to recursively visit children
8048  *
8049  * \sa Ast::visit_children for example.
8050  */
8051  void visit_children(visitor::Visitor& v) override;
8052 
8053  /**
8054  * \brief visit children i.e. member variables of current node using provided visitor
8055  *
8056  * Different nodes in the AST have different members (i.e. children). This method
8057  * recursively visits children using provided visitor.
8058  *
8059  * \param v Concrete constant visitor that will be used to recursively visit children
8060  *
8061  * \sa Ast::visit_children for example.
8062  */
8063  void visit_children(visitor::ConstVisitor& v) const override;
8064 
8065  /**
8066  * \brief accept (or visit) the current AST node using provided visitor
8067  *
8068  * Instead of visiting children of AST node, like Ast::visit_children,
8069  * accept allows to visit the current node itself using provided concrete
8070  * visitor.
8071  *
8072  * \param v Concrete visitor that will be used to recursively visit node
8073  *
8074  * \sa Ast::accept for example.
8075  */
8076  void accept(visitor::Visitor& v) override;
8077 
8078  /**
8079  * \copydoc accept(visitor::Visitor&)
8080  */
8081  void accept(visitor::ConstVisitor& v) const override;
8082 
8083  /// \}
8084 
8085 
8086 
8087  private:
8088  /**
8089  * \brief Set this object as parent for all the children
8090  *
8091  * This should be called in every object (with children) constructor
8092  * to set parents. Since it is called only in the constructors it
8093  * should not be virtual to avoid ambiguities (issue #295).
8094  */
8095  void set_parent_in_children();
8096 };
8097 
8098 /** @} */ // end of ast_class
8099 
8100 
8101 } // namespace ast
8102 } // namespace nmodl
8103 #endif // !NMODL_AST_ASSIGNED_BLOCK_HPP
8104 #ifndef NMODL_AST_STATE_BLOCK_HPP
8105 #define NMODL_AST_STATE_BLOCK_HPP
8106 
8107 
8108 namespace nmodl {
8109 namespace ast {
8110 
8111 /**
8112  * @addtogroup ast_class
8113  * @ingroup ast
8114  * @{
8115  */
8116 
8117 /**
8118  * \brief Represents a `STATE` block in the NMODL
8119  *
8120  * If a model involves differential equations, families of algebraic equations,
8121  * or kinetic reaction schemes, their dependent variables or unknowns are to be
8122  * listed in the `STATE` block. Below is an example of `STATE`:
8123  *
8124  * \code{.mod}
8125  * STATE {
8126  * m
8127  * h
8128  * }
8129  * \endcode
8130  *
8131  * Note that the state variable specification has form of ast::AssignedDefinition and
8132  * hence can have associated unit specification.
8133  *
8134 */
8135 class StateBlock : public Block {
8136  private:
8137  /// Vector of state variables
8139  /// token with location information
8140  std::shared_ptr<ModToken> token;
8141  /// symbol table for a block
8142  symtab::SymbolTable* symtab = nullptr;
8143 
8144  public:
8145 
8146  /// \name Ctor & dtor
8147  /// \{
8148 
8149  explicit StateBlock(AssignedDefinitionVector definitions);
8150  StateBlock(const StateBlock& obj);
8151 
8152 
8153  virtual ~StateBlock() = default;
8154 
8155  /// \}
8156 
8157 
8158 
8159 
8160 
8161 
8162  /**
8163  * \brief Check if the ast node is an instance of ast::StateBlock
8164  * \return true as object is of type ast::StateBlock
8165  */
8166  bool is_state_block () const noexcept override {
8167  return true;
8168  }
8169 
8170  /**
8171  * \brief Return a copy of the current node
8172  *
8173  * Recursively make a new copy/clone of the current node including
8174  * all members and return a pointer to the node. This is used for
8175  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8176  * ast.
8177  *
8178  * @return pointer to the clone/copy of the current node
8179  */
8180  StateBlock* clone() const override {
8181  return new StateBlock(*this);
8182  }
8183 
8184  /// \name Getters
8185  /// \{
8186 
8187  /**
8188  * \brief Return type (ast::AstNodeType) of ast node
8189  *
8190  * Every node in the ast has a type defined in ast::AstNodeType and this
8191  * function is used to retrieve the same.
8192  *
8193  * \return ast node type i.e. ast::AstNodeType::STATE_BLOCK
8194  *
8195  * \sa Ast::get_node_type_name
8196  */
8197  AstNodeType get_node_type() const noexcept override {
8198  return AstNodeType::STATE_BLOCK;
8199  }
8200 
8201  /**
8202  * \brief Return type (ast::AstNodeType) of ast node as std::string
8203  *
8204  * Every node in the ast has a type defined in ast::AstNodeType.
8205  * This type name can be returned as a std::string for printing
8206  * node to text/json form.
8207  *
8208  * \return name of the node type as a string i.e. "StateBlock"
8209  *
8210  * \sa Ast::get_node_name
8211  */
8212  std::string get_node_type_name() const noexcept override {
8213  return "StateBlock";
8214  }
8215 
8216  /**
8217  * \brief Return NMODL statement of ast node as std::string
8218  *
8219  * Every node is related to a special statement in the NMODL. This
8220  * statement can be returned as a std::string for printing to
8221  * text/json form.
8222  *
8223  * \return name of the statement as a string i.e. "STATE "
8224  *
8225  * \sa Ast::get_nmodl_name
8226  */
8227  std::string get_nmodl_name() const noexcept override {
8228  return "STATE ";
8229  }
8230 
8231  /**
8232  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8233  */
8234  std::shared_ptr<Ast> get_shared_ptr() override {
8235  return std::static_pointer_cast<StateBlock>(shared_from_this());
8236  }
8237 
8238  /**
8239  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8240  */
8241  std::shared_ptr<const Ast> get_shared_ptr() const override {
8242  return std::static_pointer_cast<const StateBlock>(shared_from_this());
8243  }
8244 
8245  /**
8246  * \brief Return associated token for the current ast node
8247  *
8248  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
8249  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
8250  * nullptr to store in the nmodl::symtab::SymbolTable.
8251  *
8252  * \return pointer to token if exist otherwise nullptr
8253  */
8254  const ModToken* get_token() const noexcept override {
8255  return token.get();
8256  }
8257 
8258  /**
8259  * \brief Return associated symbol table for the current ast node
8260  *
8261  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8262  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8263  * and it can be accessed using this method.
8264  *
8265  * \return pointer to the symbol table
8266  *
8267  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8268  */
8270  return symtab;
8271  }
8272 
8273 
8274 
8275 
8276 
8277 
8278 
8279 
8280  /**
8281  * \brief Getter for member variable \ref StateBlock.definitions
8282  */
8283  const AssignedDefinitionVector& get_definitions() const noexcept {
8284  return definitions;
8285  }
8286 
8287 
8288 
8289  /// \}
8290 
8291  /// \name Setters
8292  /// \{
8293 
8294 
8295  /**
8296  * \brief Set token for the current ast node
8297  */
8298  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
8299 
8300  /**
8301  * \brief Set symbol table for the current ast node
8302  *
8303  * Top level, block scoped nodes store symbol table in the ast node.
8304  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8305  * for every node in the ast.
8306  *
8307  * \sa nmodl::visitor::SymtabVisitor
8308  */
8309  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
8310  symtab = newsymtab;
8311  }
8312 
8313 
8314 
8315  /**
8316  * \brief Setter for member variable \ref StateBlock.definitions (rvalue reference)
8317  */
8318  void set_definitions(AssignedDefinitionVector&& definitions);
8319 
8320  /**
8321  * \brief Setter for member variable \ref StateBlock.definitions
8322  */
8323  void set_definitions(const AssignedDefinitionVector& definitions);
8324 
8325 
8326  /// \}
8327 
8328  /// \name Visitor
8329  /// \{
8330 
8331  /**
8332  * \brief visit children i.e. member variables of current node using provided visitor
8333  *
8334  * Different nodes in the AST have different members (i.e. children). This method
8335  * recursively visits children using provided visitor.
8336  *
8337  * \param v Concrete visitor that will be used to recursively visit children
8338  *
8339  * \sa Ast::visit_children for example.
8340  */
8341  void visit_children(visitor::Visitor& v) override;
8342 
8343  /**
8344  * \brief visit children i.e. member variables of current node using provided visitor
8345  *
8346  * Different nodes in the AST have different members (i.e. children). This method
8347  * recursively visits children using provided visitor.
8348  *
8349  * \param v Concrete constant visitor that will be used to recursively visit children
8350  *
8351  * \sa Ast::visit_children for example.
8352  */
8353  void visit_children(visitor::ConstVisitor& v) const override;
8354 
8355  /**
8356  * \brief accept (or visit) the current AST node using provided visitor
8357  *
8358  * Instead of visiting children of AST node, like Ast::visit_children,
8359  * accept allows to visit the current node itself using provided concrete
8360  * visitor.
8361  *
8362  * \param v Concrete visitor that will be used to recursively visit node
8363  *
8364  * \sa Ast::accept for example.
8365  */
8366  void accept(visitor::Visitor& v) override;
8367 
8368  /**
8369  * \copydoc accept(visitor::Visitor&)
8370  */
8371  void accept(visitor::ConstVisitor& v) const override;
8372 
8373  /// \}
8374 
8375 
8376 
8377  private:
8378  /**
8379  * \brief Set this object as parent for all the children
8380  *
8381  * This should be called in every object (with children) constructor
8382  * to set parents. Since it is called only in the constructors it
8383  * should not be virtual to avoid ambiguities (issue #295).
8384  */
8385  void set_parent_in_children();
8386 };
8387 
8388 /** @} */ // end of ast_class
8389 
8390 
8391 } // namespace ast
8392 } // namespace nmodl
8393 #endif // !NMODL_AST_STATE_BLOCK_HPP
8394 #ifndef NMODL_AST_PLOT_BLOCK_HPP
8395 #define NMODL_AST_PLOT_BLOCK_HPP
8396 
8397 
8398 namespace nmodl {
8399 namespace ast {
8400 
8401 /**
8402  * @addtogroup ast_class
8403  * @ingroup ast
8404  * @{
8405  */
8406 
8407 /**
8408  * \brief Represents a `PLOT` statement in the NMODL
8409  *
8410  * `PLOT` construct doesn't have block scope but it's standalone, global scoped
8411  * statement of the form:
8412  *
8413  * \code{.mod}
8414  * PLOT name1, index_var2 VS name3
8415  * \endcode
8416  *
8417  * \todo Check ModelDB and other databse for example of channel.
8418  *
8419 */
8420 class PlotBlock : public Block {
8421  private:
8422  /// Vector of plot variables
8423  std::shared_ptr<PlotDeclaration> plot;
8424  /// token with location information
8425  std::shared_ptr<ModToken> token;
8426  /// symbol table for a block
8427  symtab::SymbolTable* symtab = nullptr;
8428 
8429  public:
8430 
8431  /// \name Ctor & dtor
8432  /// \{
8433 
8434  explicit PlotBlock(PlotDeclaration* plot);
8435  explicit PlotBlock(const std::shared_ptr<PlotDeclaration>& plot);
8436  PlotBlock(const PlotBlock& obj);
8437 
8438 
8439  virtual ~PlotBlock() = default;
8440 
8441  /// \}
8442 
8443 
8444 
8445 
8446 
8447 
8448  /**
8449  * \brief Check if the ast node is an instance of ast::PlotBlock
8450  * \return true as object is of type ast::PlotBlock
8451  */
8452  bool is_plot_block () const noexcept override {
8453  return true;
8454  }
8455 
8456  /**
8457  * \brief Return a copy of the current node
8458  *
8459  * Recursively make a new copy/clone of the current node including
8460  * all members and return a pointer to the node. This is used for
8461  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8462  * ast.
8463  *
8464  * @return pointer to the clone/copy of the current node
8465  */
8466  PlotBlock* clone() const override {
8467  return new PlotBlock(*this);
8468  }
8469 
8470  /// \name Getters
8471  /// \{
8472 
8473  /**
8474  * \brief Return type (ast::AstNodeType) of ast node
8475  *
8476  * Every node in the ast has a type defined in ast::AstNodeType and this
8477  * function is used to retrieve the same.
8478  *
8479  * \return ast node type i.e. ast::AstNodeType::PLOT_BLOCK
8480  *
8481  * \sa Ast::get_node_type_name
8482  */
8483  AstNodeType get_node_type() const noexcept override {
8484  return AstNodeType::PLOT_BLOCK;
8485  }
8486 
8487  /**
8488  * \brief Return type (ast::AstNodeType) of ast node as std::string
8489  *
8490  * Every node in the ast has a type defined in ast::AstNodeType.
8491  * This type name can be returned as a std::string for printing
8492  * node to text/json form.
8493  *
8494  * \return name of the node type as a string i.e. "PlotBlock"
8495  *
8496  * \sa Ast::get_node_name
8497  */
8498  std::string get_node_type_name() const noexcept override {
8499  return "PlotBlock";
8500  }
8501 
8502 
8503  /**
8504  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8505  */
8506  std::shared_ptr<Ast> get_shared_ptr() override {
8507  return std::static_pointer_cast<PlotBlock>(shared_from_this());
8508  }
8509 
8510  /**
8511  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8512  */
8513  std::shared_ptr<const Ast> get_shared_ptr() const override {
8514  return std::static_pointer_cast<const PlotBlock>(shared_from_this());
8515  }
8516 
8517  /**
8518  * \brief Return associated token for the current ast node
8519  *
8520  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
8521  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
8522  * nullptr to store in the nmodl::symtab::SymbolTable.
8523  *
8524  * \return pointer to token if exist otherwise nullptr
8525  */
8526  const ModToken* get_token() const noexcept override {
8527  return token.get();
8528  }
8529 
8530  /**
8531  * \brief Return associated symbol table for the current ast node
8532  *
8533  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8534  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8535  * and it can be accessed using this method.
8536  *
8537  * \return pointer to the symbol table
8538  *
8539  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8540  */
8542  return symtab;
8543  }
8544 
8545 
8546 
8547 
8548 
8549 
8550 
8551 
8552  /**
8553  * \brief Getter for member variable \ref PlotBlock.plot
8554  */
8555  const std::shared_ptr<PlotDeclaration>& get_plot() const noexcept {
8556  return plot;
8557  }
8558 
8559 
8560 
8561  /// \}
8562 
8563  /// \name Setters
8564  /// \{
8565 
8566 
8567  /**
8568  * \brief Set token for the current ast node
8569  */
8570  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
8571 
8572  /**
8573  * \brief Set symbol table for the current ast node
8574  *
8575  * Top level, block scoped nodes store symbol table in the ast node.
8576  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8577  * for every node in the ast.
8578  *
8579  * \sa nmodl::visitor::SymtabVisitor
8580  */
8581  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
8582  symtab = newsymtab;
8583  }
8584 
8585 
8586 
8587  /**
8588  * \brief Setter for member variable \ref PlotBlock.plot (rvalue reference)
8589  */
8590  void set_plot(std::shared_ptr<PlotDeclaration>&& plot);
8591 
8592  /**
8593  * \brief Setter for member variable \ref PlotBlock.plot
8594  */
8595  void set_plot(const std::shared_ptr<PlotDeclaration>& plot);
8596 
8597 
8598  /// \}
8599 
8600  /// \name Visitor
8601  /// \{
8602 
8603  /**
8604  * \brief visit children i.e. member variables of current node using provided visitor
8605  *
8606  * Different nodes in the AST have different members (i.e. children). This method
8607  * recursively visits children using provided visitor.
8608  *
8609  * \param v Concrete visitor that will be used to recursively visit children
8610  *
8611  * \sa Ast::visit_children for example.
8612  */
8613  void visit_children(visitor::Visitor& v) override;
8614 
8615  /**
8616  * \brief visit children i.e. member variables of current node using provided visitor
8617  *
8618  * Different nodes in the AST have different members (i.e. children). This method
8619  * recursively visits children using provided visitor.
8620  *
8621  * \param v Concrete constant visitor that will be used to recursively visit children
8622  *
8623  * \sa Ast::visit_children for example.
8624  */
8625  void visit_children(visitor::ConstVisitor& v) const override;
8626 
8627  /**
8628  * \brief accept (or visit) the current AST node using provided visitor
8629  *
8630  * Instead of visiting children of AST node, like Ast::visit_children,
8631  * accept allows to visit the current node itself using provided concrete
8632  * visitor.
8633  *
8634  * \param v Concrete visitor that will be used to recursively visit node
8635  *
8636  * \sa Ast::accept for example.
8637  */
8638  void accept(visitor::Visitor& v) override;
8639 
8640  /**
8641  * \copydoc accept(visitor::Visitor&)
8642  */
8643  void accept(visitor::ConstVisitor& v) const override;
8644 
8645  /// \}
8646 
8647 
8648 
8649  private:
8650  /**
8651  * \brief Set this object as parent for all the children
8652  *
8653  * This should be called in every object (with children) constructor
8654  * to set parents. Since it is called only in the constructors it
8655  * should not be virtual to avoid ambiguities (issue #295).
8656  */
8657  void set_parent_in_children();
8658 };
8659 
8660 /** @} */ // end of ast_class
8661 
8662 
8663 } // namespace ast
8664 } // namespace nmodl
8665 #endif // !NMODL_AST_PLOT_BLOCK_HPP
8666 #ifndef NMODL_AST_INITIAL_BLOCK_HPP
8667 #define NMODL_AST_INITIAL_BLOCK_HPP
8668 
8669 
8670 namespace nmodl {
8671 namespace ast {
8672 
8673 /**
8674  * @addtogroup ast_class
8675  * @ingroup ast
8676  * @{
8677  */
8678 
8679 /**
8680  * \brief Represents a `INITIAL` block in the NMODL
8681  *
8682  * The code in the `INITIAL` block is executed when the hoc function `finitialize()`
8683  * is called. Here is an example :
8684  *
8685  * \code{.mod}
8686  * INITIAL {
8687  * rates(v+vshift)
8688  * m = minf
8689  * h = hinf
8690  * tadj = q10^((celsius - temp)/10)
8691  * }
8692  * \endcode
8693  *
8694 */
8695 class InitialBlock : public Block {
8696  private:
8697  /// Block with statements vector
8698  std::shared_ptr<StatementBlock> statement_block;
8699  /// token with location information
8700  std::shared_ptr<ModToken> token;
8701  /// symbol table for a block
8702  symtab::SymbolTable* symtab = nullptr;
8703 
8704  public:
8705 
8706  /// \name Ctor & dtor
8707  /// \{
8708 
8709  explicit InitialBlock(StatementBlock* statement_block);
8710  explicit InitialBlock(const std::shared_ptr<StatementBlock>& statement_block);
8711  InitialBlock(const InitialBlock& obj);
8712 
8713 
8714  virtual ~InitialBlock() = default;
8715 
8716  /// \}
8717 
8718 
8719 
8720 
8721 
8722 
8723  /**
8724  * \brief Check if the ast node is an instance of ast::InitialBlock
8725  * \return true as object is of type ast::InitialBlock
8726  */
8727  bool is_initial_block () const noexcept override {
8728  return true;
8729  }
8730 
8731  /**
8732  * \brief Return a copy of the current node
8733  *
8734  * Recursively make a new copy/clone of the current node including
8735  * all members and return a pointer to the node. This is used for
8736  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8737  * ast.
8738  *
8739  * @return pointer to the clone/copy of the current node
8740  */
8741  InitialBlock* clone() const override {
8742  return new InitialBlock(*this);
8743  }
8744 
8745  /// \name Getters
8746  /// \{
8747 
8748  /**
8749  * \brief Return type (ast::AstNodeType) of ast node
8750  *
8751  * Every node in the ast has a type defined in ast::AstNodeType and this
8752  * function is used to retrieve the same.
8753  *
8754  * \return ast node type i.e. ast::AstNodeType::INITIAL_BLOCK
8755  *
8756  * \sa Ast::get_node_type_name
8757  */
8758  AstNodeType get_node_type() const noexcept override {
8760  }
8761 
8762  /**
8763  * \brief Return type (ast::AstNodeType) of ast node as std::string
8764  *
8765  * Every node in the ast has a type defined in ast::AstNodeType.
8766  * This type name can be returned as a std::string for printing
8767  * node to text/json form.
8768  *
8769  * \return name of the node type as a string i.e. "InitialBlock"
8770  *
8771  * \sa Ast::get_node_name
8772  */
8773  std::string get_node_type_name() const noexcept override {
8774  return "InitialBlock";
8775  }
8776 
8777  /**
8778  * \brief Return NMODL statement of ast node as std::string
8779  *
8780  * Every node is related to a special statement in the NMODL. This
8781  * statement can be returned as a std::string for printing to
8782  * text/json form.
8783  *
8784  * \return name of the statement as a string i.e. "INITIAL "
8785  *
8786  * \sa Ast::get_nmodl_name
8787  */
8788  std::string get_nmodl_name() const noexcept override {
8789  return "INITIAL ";
8790  }
8791 
8792  /**
8793  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8794  */
8795  std::shared_ptr<Ast> get_shared_ptr() override {
8796  return std::static_pointer_cast<InitialBlock>(shared_from_this());
8797  }
8798 
8799  /**
8800  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8801  */
8802  std::shared_ptr<const Ast> get_shared_ptr() const override {
8803  return std::static_pointer_cast<const InitialBlock>(shared_from_this());
8804  }
8805 
8806  /**
8807  * \brief Return associated token for the current ast node
8808  *
8809  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
8810  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
8811  * nullptr to store in the nmodl::symtab::SymbolTable.
8812  *
8813  * \return pointer to token if exist otherwise nullptr
8814  */
8815  const ModToken* get_token() const noexcept override {
8816  return token.get();
8817  }
8818 
8819  /**
8820  * \brief Return associated symbol table for the current ast node
8821  *
8822  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8823  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8824  * and it can be accessed using this method.
8825  *
8826  * \return pointer to the symbol table
8827  *
8828  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8829  */
8831  return symtab;
8832  }
8833 
8834 
8835 
8836 
8837 
8838 
8839 
8840 
8841  /**
8842  * \brief Getter for member variable \ref InitialBlock.statement_block
8843  */
8844  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
8845  return statement_block;
8846  }
8847 
8848 
8849 
8850  /// \}
8851 
8852  /// \name Setters
8853  /// \{
8854 
8855 
8856  /**
8857  * \brief Set token for the current ast node
8858  */
8859  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
8860 
8861  /**
8862  * \brief Set symbol table for the current ast node
8863  *
8864  * Top level, block scoped nodes store symbol table in the ast node.
8865  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8866  * for every node in the ast.
8867  *
8868  * \sa nmodl::visitor::SymtabVisitor
8869  */
8870  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
8871  symtab = newsymtab;
8872  }
8873 
8874 
8875 
8876  /**
8877  * \brief Setter for member variable \ref InitialBlock.statement_block (rvalue reference)
8878  */
8879  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
8880 
8881  /**
8882  * \brief Setter for member variable \ref InitialBlock.statement_block
8883  */
8884  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
8885 
8886 
8887  /// \}
8888 
8889  /// \name Visitor
8890  /// \{
8891 
8892  /**
8893  * \brief visit children i.e. member variables of current node using provided visitor
8894  *
8895  * Different nodes in the AST have different members (i.e. children). This method
8896  * recursively visits children using provided visitor.
8897  *
8898  * \param v Concrete visitor that will be used to recursively visit children
8899  *
8900  * \sa Ast::visit_children for example.
8901  */
8902  void visit_children(visitor::Visitor& v) override;
8903 
8904  /**
8905  * \brief visit children i.e. member variables of current node using provided visitor
8906  *
8907  * Different nodes in the AST have different members (i.e. children). This method
8908  * recursively visits children using provided visitor.
8909  *
8910  * \param v Concrete constant visitor that will be used to recursively visit children
8911  *
8912  * \sa Ast::visit_children for example.
8913  */
8914  void visit_children(visitor::ConstVisitor& v) const override;
8915 
8916  /**
8917  * \brief accept (or visit) the current AST node using provided visitor
8918  *
8919  * Instead of visiting children of AST node, like Ast::visit_children,
8920  * accept allows to visit the current node itself using provided concrete
8921  * visitor.
8922  *
8923  * \param v Concrete visitor that will be used to recursively visit node
8924  *
8925  * \sa Ast::accept for example.
8926  */
8927  void accept(visitor::Visitor& v) override;
8928 
8929  /**
8930  * \copydoc accept(visitor::Visitor&)
8931  */
8932  void accept(visitor::ConstVisitor& v) const override;
8933 
8934  /// \}
8935 
8936 
8937 
8938  private:
8939  /**
8940  * \brief Set this object as parent for all the children
8941  *
8942  * This should be called in every object (with children) constructor
8943  * to set parents. Since it is called only in the constructors it
8944  * should not be virtual to avoid ambiguities (issue #295).
8945  */
8946  void set_parent_in_children();
8947 };
8948 
8949 /** @} */ // end of ast_class
8950 
8951 
8952 } // namespace ast
8953 } // namespace nmodl
8954 #endif // !NMODL_AST_INITIAL_BLOCK_HPP
8955 #ifndef NMODL_AST_CONSTRUCTOR_BLOCK_HPP
8956 #define NMODL_AST_CONSTRUCTOR_BLOCK_HPP
8957 
8958 
8959 namespace nmodl {
8960 namespace ast {
8961 
8962 /**
8963  * @addtogroup ast_class
8964  * @ingroup ast
8965  * @{
8966  */
8967 
8968 /**
8969  * \brief Represents a `CONSTRUCTOR` block in the NMODL
8970  *
8971  * The code in the `CONSTRUCTOR` is called when the channel is instantiated. Like any
8972  * other global block, `CONSTRUCTOR` block can have any statements. It often used with
8973  * `VERBATIM` block for initialization purpose :
8974  *
8975  * \code{.mod}
8976  * CONSTRUCTOR {
8977  * VERBATIM
8978  * if (ifarg(1)) { id= *getarg(1); } else { id= -1; }
8979  * ENDVERBATIM
8980  * }
8981  * \endcode
8982  *
8983  * \sa ast::DestructorBlock
8984  *
8985 */
8986 class ConstructorBlock : public Block {
8987  private:
8988  /// Block with statements vector
8989  std::shared_ptr<StatementBlock> statement_block;
8990  /// token with location information
8991  std::shared_ptr<ModToken> token;
8992  /// symbol table for a block
8993  symtab::SymbolTable* symtab = nullptr;
8994 
8995  public:
8996 
8997  /// \name Ctor & dtor
8998  /// \{
8999 
9000  explicit ConstructorBlock(StatementBlock* statement_block);
9001  explicit ConstructorBlock(const std::shared_ptr<StatementBlock>& statement_block);
9002  ConstructorBlock(const ConstructorBlock& obj);
9003 
9004 
9005  virtual ~ConstructorBlock() = default;
9006 
9007  /// \}
9008 
9009 
9010 
9011 
9012 
9013 
9014  /**
9015  * \brief Check if the ast node is an instance of ast::ConstructorBlock
9016  * \return true as object is of type ast::ConstructorBlock
9017  */
9018  bool is_constructor_block () const noexcept override {
9019  return true;
9020  }
9021 
9022  /**
9023  * \brief Return a copy of the current node
9024  *
9025  * Recursively make a new copy/clone of the current node including
9026  * all members and return a pointer to the node. This is used for
9027  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9028  * ast.
9029  *
9030  * @return pointer to the clone/copy of the current node
9031  */
9032  ConstructorBlock* clone() const override {
9033  return new ConstructorBlock(*this);
9034  }
9035 
9036  /// \name Getters
9037  /// \{
9038 
9039  /**
9040  * \brief Return type (ast::AstNodeType) of ast node
9041  *
9042  * Every node in the ast has a type defined in ast::AstNodeType and this
9043  * function is used to retrieve the same.
9044  *
9045  * \return ast node type i.e. ast::AstNodeType::CONSTRUCTOR_BLOCK
9046  *
9047  * \sa Ast::get_node_type_name
9048  */
9049  AstNodeType get_node_type() const noexcept override {
9051  }
9052 
9053  /**
9054  * \brief Return type (ast::AstNodeType) of ast node as std::string
9055  *
9056  * Every node in the ast has a type defined in ast::AstNodeType.
9057  * This type name can be returned as a std::string for printing
9058  * node to text/json form.
9059  *
9060  * \return name of the node type as a string i.e. "ConstructorBlock"
9061  *
9062  * \sa Ast::get_node_name
9063  */
9064  std::string get_node_type_name() const noexcept override {
9065  return "ConstructorBlock";
9066  }
9067 
9068  /**
9069  * \brief Return NMODL statement of ast node as std::string
9070  *
9071  * Every node is related to a special statement in the NMODL. This
9072  * statement can be returned as a std::string for printing to
9073  * text/json form.
9074  *
9075  * \return name of the statement as a string i.e. "CONSTRUCTOR "
9076  *
9077  * \sa Ast::get_nmodl_name
9078  */
9079  std::string get_nmodl_name() const noexcept override {
9080  return "CONSTRUCTOR ";
9081  }
9082 
9083  /**
9084  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9085  */
9086  std::shared_ptr<Ast> get_shared_ptr() override {
9087  return std::static_pointer_cast<ConstructorBlock>(shared_from_this());
9088  }
9089 
9090  /**
9091  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9092  */
9093  std::shared_ptr<const Ast> get_shared_ptr() const override {
9094  return std::static_pointer_cast<const ConstructorBlock>(shared_from_this());
9095  }
9096 
9097  /**
9098  * \brief Return associated token for the current ast node
9099  *
9100  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
9101  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
9102  * nullptr to store in the nmodl::symtab::SymbolTable.
9103  *
9104  * \return pointer to token if exist otherwise nullptr
9105  */
9106  const ModToken* get_token() const noexcept override {
9107  return token.get();
9108  }
9109 
9110  /**
9111  * \brief Return associated symbol table for the current ast node
9112  *
9113  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9114  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9115  * and it can be accessed using this method.
9116  *
9117  * \return pointer to the symbol table
9118  *
9119  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9120  */
9122  return symtab;
9123  }
9124 
9125 
9126 
9127 
9128 
9129 
9130 
9131 
9132  /**
9133  * \brief Getter for member variable \ref ConstructorBlock.statement_block
9134  */
9135  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
9136  return statement_block;
9137  }
9138 
9139 
9140 
9141  /// \}
9142 
9143  /// \name Setters
9144  /// \{
9145 
9146 
9147  /**
9148  * \brief Set token for the current ast node
9149  */
9150  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
9151 
9152  /**
9153  * \brief Set symbol table for the current ast node
9154  *
9155  * Top level, block scoped nodes store symbol table in the ast node.
9156  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9157  * for every node in the ast.
9158  *
9159  * \sa nmodl::visitor::SymtabVisitor
9160  */
9161  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
9162  symtab = newsymtab;
9163  }
9164 
9165 
9166 
9167  /**
9168  * \brief Setter for member variable \ref ConstructorBlock.statement_block (rvalue reference)
9169  */
9170  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
9171 
9172  /**
9173  * \brief Setter for member variable \ref ConstructorBlock.statement_block
9174  */
9175  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
9176 
9177 
9178  /// \}
9179 
9180  /// \name Visitor
9181  /// \{
9182 
9183  /**
9184  * \brief visit children i.e. member variables of current node using provided visitor
9185  *
9186  * Different nodes in the AST have different members (i.e. children). This method
9187  * recursively visits children using provided visitor.
9188  *
9189  * \param v Concrete visitor that will be used to recursively visit children
9190  *
9191  * \sa Ast::visit_children for example.
9192  */
9193  void visit_children(visitor::Visitor& v) override;
9194 
9195  /**
9196  * \brief visit children i.e. member variables of current node using provided visitor
9197  *
9198  * Different nodes in the AST have different members (i.e. children). This method
9199  * recursively visits children using provided visitor.
9200  *
9201  * \param v Concrete constant visitor that will be used to recursively visit children
9202  *
9203  * \sa Ast::visit_children for example.
9204  */
9205  void visit_children(visitor::ConstVisitor& v) const override;
9206 
9207  /**
9208  * \brief accept (or visit) the current AST node using provided visitor
9209  *
9210  * Instead of visiting children of AST node, like Ast::visit_children,
9211  * accept allows to visit the current node itself using provided concrete
9212  * visitor.
9213  *
9214  * \param v Concrete visitor that will be used to recursively visit node
9215  *
9216  * \sa Ast::accept for example.
9217  */
9218  void accept(visitor::Visitor& v) override;
9219 
9220  /**
9221  * \copydoc accept(visitor::Visitor&)
9222  */
9223  void accept(visitor::ConstVisitor& v) const override;
9224 
9225  /// \}
9226 
9227 
9228 
9229  private:
9230  /**
9231  * \brief Set this object as parent for all the children
9232  *
9233  * This should be called in every object (with children) constructor
9234  * to set parents. Since it is called only in the constructors it
9235  * should not be virtual to avoid ambiguities (issue #295).
9236  */
9237  void set_parent_in_children();
9238 };
9239 
9240 /** @} */ // end of ast_class
9241 
9242 
9243 } // namespace ast
9244 } // namespace nmodl
9245 #endif // !NMODL_AST_CONSTRUCTOR_BLOCK_HPP
9246 #ifndef NMODL_AST_DESTRUCTOR_BLOCK_HPP
9247 #define NMODL_AST_DESTRUCTOR_BLOCK_HPP
9248 
9249 
9250 namespace nmodl {
9251 namespace ast {
9252 
9253 /**
9254  * @addtogroup ast_class
9255  * @ingroup ast
9256  * @{
9257  */
9258 
9259 /**
9260  * \brief Represents a `DESTRUCTOR` block in the NMODL
9261  *
9262  * The code in the `DESTRUCTOR` is called when the channel instance is deleted. It often
9263  * used with `VERBATIM` block for finalization purpose :
9264  *
9265  * \code{.mod}
9266  * DESTRUCTOR {
9267  * VERBATIM {
9268  * nsyn = maxsyn = 0;
9269  * free(PRECAST);
9270  * link = 0;
9271  * }
9272  * ENDVERBATIM
9273  * }
9274  * \endcode
9275  *
9276  * \sa ast::ConstructorBlock
9277  *
9278 */
9279 class DestructorBlock : public Block {
9280  private:
9281  /// Block with statements vector
9282  std::shared_ptr<StatementBlock> statement_block;
9283  /// token with location information
9284  std::shared_ptr<ModToken> token;
9285  /// symbol table for a block
9286  symtab::SymbolTable* symtab = nullptr;
9287 
9288  public:
9289 
9290  /// \name Ctor & dtor
9291  /// \{
9292 
9293  explicit DestructorBlock(StatementBlock* statement_block);
9294  explicit DestructorBlock(const std::shared_ptr<StatementBlock>& statement_block);
9295  DestructorBlock(const DestructorBlock& obj);
9296 
9297 
9298  virtual ~DestructorBlock() = default;
9299 
9300  /// \}
9301 
9302 
9303 
9304 
9305 
9306 
9307  /**
9308  * \brief Check if the ast node is an instance of ast::DestructorBlock
9309  * \return true as object is of type ast::DestructorBlock
9310  */
9311  bool is_destructor_block () const noexcept override {
9312  return true;
9313  }
9314 
9315  /**
9316  * \brief Return a copy of the current node
9317  *
9318  * Recursively make a new copy/clone of the current node including
9319  * all members and return a pointer to the node. This is used for
9320  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9321  * ast.
9322  *
9323  * @return pointer to the clone/copy of the current node
9324  */
9325  DestructorBlock* clone() const override {
9326  return new DestructorBlock(*this);
9327  }
9328 
9329  /// \name Getters
9330  /// \{
9331 
9332  /**
9333  * \brief Return type (ast::AstNodeType) of ast node
9334  *
9335  * Every node in the ast has a type defined in ast::AstNodeType and this
9336  * function is used to retrieve the same.
9337  *
9338  * \return ast node type i.e. ast::AstNodeType::DESTRUCTOR_BLOCK
9339  *
9340  * \sa Ast::get_node_type_name
9341  */
9342  AstNodeType get_node_type() const noexcept override {
9344  }
9345 
9346  /**
9347  * \brief Return type (ast::AstNodeType) of ast node as std::string
9348  *
9349  * Every node in the ast has a type defined in ast::AstNodeType.
9350  * This type name can be returned as a std::string for printing
9351  * node to text/json form.
9352  *
9353  * \return name of the node type as a string i.e. "DestructorBlock"
9354  *
9355  * \sa Ast::get_node_name
9356  */
9357  std::string get_node_type_name() const noexcept override {
9358  return "DestructorBlock";
9359  }
9360 
9361  /**
9362  * \brief Return NMODL statement of ast node as std::string
9363  *
9364  * Every node is related to a special statement in the NMODL. This
9365  * statement can be returned as a std::string for printing to
9366  * text/json form.
9367  *
9368  * \return name of the statement as a string i.e. "DESTRUCTOR "
9369  *
9370  * \sa Ast::get_nmodl_name
9371  */
9372  std::string get_nmodl_name() const noexcept override {
9373  return "DESTRUCTOR ";
9374  }
9375 
9376  /**
9377  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9378  */
9379  std::shared_ptr<Ast> get_shared_ptr() override {
9380  return std::static_pointer_cast<DestructorBlock>(shared_from_this());
9381  }
9382 
9383  /**
9384  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9385  */
9386  std::shared_ptr<const Ast> get_shared_ptr() const override {
9387  return std::static_pointer_cast<const DestructorBlock>(shared_from_this());
9388  }
9389 
9390  /**
9391  * \brief Return associated token for the current ast node
9392  *
9393  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
9394  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
9395  * nullptr to store in the nmodl::symtab::SymbolTable.
9396  *
9397  * \return pointer to token if exist otherwise nullptr
9398  */
9399  const ModToken* get_token() const noexcept override {
9400  return token.get();
9401  }
9402 
9403  /**
9404  * \brief Return associated symbol table for the current ast node
9405  *
9406  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9407  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9408  * and it can be accessed using this method.
9409  *
9410  * \return pointer to the symbol table
9411  *
9412  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9413  */
9415  return symtab;
9416  }
9417 
9418 
9419 
9420 
9421 
9422 
9423 
9424 
9425  /**
9426  * \brief Getter for member variable \ref DestructorBlock.statement_block
9427  */
9428  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
9429  return statement_block;
9430  }
9431 
9432 
9433 
9434  /// \}
9435 
9436  /// \name Setters
9437  /// \{
9438 
9439 
9440  /**
9441  * \brief Set token for the current ast node
9442  */
9443  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
9444 
9445  /**
9446  * \brief Set symbol table for the current ast node
9447  *
9448  * Top level, block scoped nodes store symbol table in the ast node.
9449  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9450  * for every node in the ast.
9451  *
9452  * \sa nmodl::visitor::SymtabVisitor
9453  */
9454  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
9455  symtab = newsymtab;
9456  }
9457 
9458 
9459 
9460  /**
9461  * \brief Setter for member variable \ref DestructorBlock.statement_block (rvalue reference)
9462  */
9463  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
9464 
9465  /**
9466  * \brief Setter for member variable \ref DestructorBlock.statement_block
9467  */
9468  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
9469 
9470 
9471  /// \}
9472 
9473  /// \name Visitor
9474  /// \{
9475 
9476  /**
9477  * \brief visit children i.e. member variables of current node using provided visitor
9478  *
9479  * Different nodes in the AST have different members (i.e. children). This method
9480  * recursively visits children using provided visitor.
9481  *
9482  * \param v Concrete visitor that will be used to recursively visit children
9483  *
9484  * \sa Ast::visit_children for example.
9485  */
9486  void visit_children(visitor::Visitor& v) override;
9487 
9488  /**
9489  * \brief visit children i.e. member variables of current node using provided visitor
9490  *
9491  * Different nodes in the AST have different members (i.e. children). This method
9492  * recursively visits children using provided visitor.
9493  *
9494  * \param v Concrete constant visitor that will be used to recursively visit children
9495  *
9496  * \sa Ast::visit_children for example.
9497  */
9498  void visit_children(visitor::ConstVisitor& v) const override;
9499 
9500  /**
9501  * \brief accept (or visit) the current AST node using provided visitor
9502  *
9503  * Instead of visiting children of AST node, like Ast::visit_children,
9504  * accept allows to visit the current node itself using provided concrete
9505  * visitor.
9506  *
9507  * \param v Concrete visitor that will be used to recursively visit node
9508  *
9509  * \sa Ast::accept for example.
9510  */
9511  void accept(visitor::Visitor& v) override;
9512 
9513  /**
9514  * \copydoc accept(visitor::Visitor&)
9515  */
9516  void accept(visitor::ConstVisitor& v) const override;
9517 
9518  /// \}
9519 
9520 
9521 
9522  private:
9523  /**
9524  * \brief Set this object as parent for all the children
9525  *
9526  * This should be called in every object (with children) constructor
9527  * to set parents. Since it is called only in the constructors it
9528  * should not be virtual to avoid ambiguities (issue #295).
9529  */
9530  void set_parent_in_children();
9531 };
9532 
9533 /** @} */ // end of ast_class
9534 
9535 
9536 } // namespace ast
9537 } // namespace nmodl
9538 #endif // !NMODL_AST_DESTRUCTOR_BLOCK_HPP
9539 #ifndef NMODL_AST_STATEMENT_BLOCK_HPP
9540 #define NMODL_AST_STATEMENT_BLOCK_HPP
9541 #define NMODL_AST_STATEMENT_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
9542 
9543 
9544 namespace nmodl {
9545 namespace ast {
9546 
9547 /**
9548  * @addtogroup ast_class
9549  * @ingroup ast
9550  * @{
9551  */
9552 
9553 /**
9554  * \brief Represents block encapsulating list of statements
9555  *
9556  * Statement block is used to hold list of statements between `{ }`. This
9557  * represents a new block scope in the mod file and has following form :
9558  *
9559  * \code{.mod}
9560  * {
9561  * statement1
9562  * {
9563  * statement2
9564  * }
9565  * }
9566  * \endcode
9567  *
9568  * Note that the statement blocks can be nested where inner block will
9569  * be wrapped as statement with ast::ExpressionStatement.
9570  *
9571 */
9572 class StatementBlock : public Block {
9573  private:
9574  /// Vector of statements
9576  /// token with location information
9577  std::shared_ptr<ModToken> token;
9578  /// symbol table for a block
9579  symtab::SymbolTable* symtab = nullptr;
9580 
9581  public:
9582 
9583  /// \name Ctor & dtor
9584  /// \{
9585 
9586  explicit StatementBlock(StatementVector statements);
9587  StatementBlock(const StatementBlock& obj);
9588 
9589 
9590  virtual ~StatementBlock() = default;
9591 
9592  /// \}
9593 
9594 
9595 
9596 
9597 
9598 
9599  /**
9600  * \brief Check if the ast node is an instance of ast::StatementBlock
9601  * \return true as object is of type ast::StatementBlock
9602  */
9603  bool is_statement_block () const noexcept override {
9604  return true;
9605  }
9606 
9607  /**
9608  * \brief Return a copy of the current node
9609  *
9610  * Recursively make a new copy/clone of the current node including
9611  * all members and return a pointer to the node. This is used for
9612  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9613  * ast.
9614  *
9615  * @return pointer to the clone/copy of the current node
9616  */
9617  StatementBlock* clone() const override {
9618  return new StatementBlock(*this);
9619  }
9620 
9621  /// \name Getters
9622  /// \{
9623 
9624  /**
9625  * \brief Return type (ast::AstNodeType) of ast node
9626  *
9627  * Every node in the ast has a type defined in ast::AstNodeType and this
9628  * function is used to retrieve the same.
9629  *
9630  * \return ast node type i.e. ast::AstNodeType::STATEMENT_BLOCK
9631  *
9632  * \sa Ast::get_node_type_name
9633  */
9634  AstNodeType get_node_type() const noexcept override {
9636  }
9637 
9638  /**
9639  * \brief Return type (ast::AstNodeType) of ast node as std::string
9640  *
9641  * Every node in the ast has a type defined in ast::AstNodeType.
9642  * This type name can be returned as a std::string for printing
9643  * node to text/json form.
9644  *
9645  * \return name of the node type as a string i.e. "StatementBlock"
9646  *
9647  * \sa Ast::get_node_name
9648  */
9649  std::string get_node_type_name() const noexcept override {
9650  return "StatementBlock";
9651  }
9652 
9653 
9654  /**
9655  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9656  */
9657  std::shared_ptr<Ast> get_shared_ptr() override {
9658  return std::static_pointer_cast<StatementBlock>(shared_from_this());
9659  }
9660 
9661  /**
9662  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9663  */
9664  std::shared_ptr<const Ast> get_shared_ptr() const override {
9665  return std::static_pointer_cast<const StatementBlock>(shared_from_this());
9666  }
9667 
9668  /**
9669  * \brief Return associated token for the current ast node
9670  *
9671  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
9672  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
9673  * nullptr to store in the nmodl::symtab::SymbolTable.
9674  *
9675  * \return pointer to token if exist otherwise nullptr
9676  */
9677  const ModToken* get_token() const noexcept override {
9678  return token.get();
9679  }
9680 
9681  /**
9682  * \brief Return associated symbol table for the current ast node
9683  *
9684  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9685  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9686  * and it can be accessed using this method.
9687  *
9688  * \return pointer to the symbol table
9689  *
9690  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9691  */
9693  return symtab;
9694  }
9695 
9696 
9697 
9698 
9699 /**
9700  * \brief Add member to statements by raw pointer
9701  */
9702 void emplace_back_statement(Statement *n);
9703 
9704 /**
9705  * \brief Add member to statements by shared_ptr
9706  */
9707 void emplace_back_statement(std::shared_ptr<Statement> n);
9708 
9709 /**
9710  * \brief Erase member to statements
9711  */
9712 StatementVector::const_iterator erase_statement(StatementVector::const_iterator first);
9713 
9714 /**
9715  * \brief Erase members to statements
9716  */
9717 StatementVector::const_iterator erase_statement(StatementVector::const_iterator first, StatementVector::const_iterator last);
9718 
9719 /**
9720  * \brief Erase non-consecutive members to statements
9721  *
9722  * loosely following the cpp reference of remove_if
9723  */
9724 size_t erase_statement(std::unordered_set<Statement*>& to_be_erased);
9725 
9726 /**
9727  * \brief Insert member to statements
9728  */
9729 StatementVector::const_iterator insert_statement(StatementVector::const_iterator position, const std::shared_ptr<Statement>& n);
9730 
9731 /**
9732  * \brief Insert members to statements
9733  */
9734 template <class NodeType, class InputIterator>
9735 void insert_statement(StatementVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last);
9736 
9737 /**
9738  * \brief Reset member to statements
9739  */
9740 void reset_statement(StatementVector::const_iterator position, Statement* n);
9741 
9742 /**
9743  * \brief Reset member to statements
9744  */
9745 void reset_statement(StatementVector::const_iterator position, std::shared_ptr<Statement> n);
9746 
9747 
9748 
9749 
9750 
9751  /**
9752  * \brief Getter for member variable \ref StatementBlock.statements
9753  */
9754  const StatementVector& get_statements() const noexcept {
9755  return statements;
9756  }
9757 
9758 
9759 
9760  /// \}
9761 
9762  /// \name Setters
9763  /// \{
9764 
9765 
9766  /**
9767  * \brief Set token for the current ast node
9768  */
9769  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
9770 
9771  /**
9772  * \brief Set symbol table for the current ast node
9773  *
9774  * Top level, block scoped nodes store symbol table in the ast node.
9775  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9776  * for every node in the ast.
9777  *
9778  * \sa nmodl::visitor::SymtabVisitor
9779  */
9780  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
9781  symtab = newsymtab;
9782  }
9783 
9784 
9785 
9786  /**
9787  * \brief Setter for member variable \ref StatementBlock.statements (rvalue reference)
9788  */
9789  void set_statements(StatementVector&& statements);
9790 
9791  /**
9792  * \brief Setter for member variable \ref StatementBlock.statements
9793  */
9794  void set_statements(const StatementVector& statements);
9795 
9796 
9797  /// \}
9798 
9799  /// \name Visitor
9800  /// \{
9801 
9802  /**
9803  * \brief visit children i.e. member variables of current node using provided visitor
9804  *
9805  * Different nodes in the AST have different members (i.e. children). This method
9806  * recursively visits children using provided visitor.
9807  *
9808  * \param v Concrete visitor that will be used to recursively visit children
9809  *
9810  * \sa Ast::visit_children for example.
9811  */
9812  void visit_children(visitor::Visitor& v) override;
9813 
9814  /**
9815  * \brief visit children i.e. member variables of current node using provided visitor
9816  *
9817  * Different nodes in the AST have different members (i.e. children). This method
9818  * recursively visits children using provided visitor.
9819  *
9820  * \param v Concrete constant visitor that will be used to recursively visit children
9821  *
9822  * \sa Ast::visit_children for example.
9823  */
9824  void visit_children(visitor::ConstVisitor& v) const override;
9825 
9826  /**
9827  * \brief accept (or visit) the current AST node using provided visitor
9828  *
9829  * Instead of visiting children of AST node, like Ast::visit_children,
9830  * accept allows to visit the current node itself using provided concrete
9831  * visitor.
9832  *
9833  * \param v Concrete visitor that will be used to recursively visit node
9834  *
9835  * \sa Ast::accept for example.
9836  */
9837  void accept(visitor::Visitor& v) override;
9838 
9839  /**
9840  * \copydoc accept(visitor::Visitor&)
9841  */
9842  void accept(visitor::ConstVisitor& v) const override;
9843 
9844  /// \}
9845 
9846 
9847 
9848  private:
9849  /**
9850  * \brief Set this object as parent for all the children
9851  *
9852  * This should be called in every object (with children) constructor
9853  * to set parents. Since it is called only in the constructors it
9854  * should not be virtual to avoid ambiguities (issue #295).
9855  */
9856  void set_parent_in_children();
9857 };
9858 
9859 /** @} */ // end of ast_class
9860 
9861 
9862 } // namespace ast
9863 } // namespace nmodl
9864 #endif // !NMODL_AST_STATEMENT_BLOCK_HPP
9865 #ifndef NMODL_AST_DERIVATIVE_BLOCK_HPP
9866 #define NMODL_AST_DERIVATIVE_BLOCK_HPP
9867 
9868 
9869 namespace nmodl {
9870 namespace ast {
9871 
9872 /**
9873  * @addtogroup ast_class
9874  * @ingroup ast
9875  * @{
9876  */
9877 
9878 /**
9879  * \brief Represents `DERIVATIVE` block in the NMODL
9880  *
9881  * This block is used to assign values to the derivatives of those
9882  * `STATE`s that are described by differential equations. The statements
9883  * in this block are of the form \f$y' = expr\f$. Here is an example :
9884  *
9885  * \code{.mod}
9886  * DERIVATIVE states {
9887  * rates(v)
9888  * m' = (minf-m)/mtau
9889  * h' = (hinf-h)/htau
9890  * }
9891  * \endcode
9892  *
9893 */
9894 class DerivativeBlock : public Block {
9895  private:
9896  /// Name of the derivative block
9897  std::shared_ptr<Name> name;
9898  /// Block with statements vector
9899  std::shared_ptr<StatementBlock> statement_block;
9900  /// token with location information
9901  std::shared_ptr<ModToken> token;
9902  /// symbol table for a block
9903  symtab::SymbolTable* symtab = nullptr;
9904 
9905  public:
9906 
9907  /// \name Ctor & dtor
9908  /// \{
9909 
9910  explicit DerivativeBlock(Name* name, StatementBlock* statement_block);
9911  explicit DerivativeBlock(const std::shared_ptr<Name>& name, const std::shared_ptr<StatementBlock>& statement_block);
9912  DerivativeBlock(const DerivativeBlock& obj);
9913 
9914 
9915  virtual ~DerivativeBlock() = default;
9916 
9917  /// \}
9918 
9919 
9920 
9921 
9922 
9923 
9924  /**
9925  * \brief Check if the ast node is an instance of ast::DerivativeBlock
9926  * \return true as object is of type ast::DerivativeBlock
9927  */
9928  bool is_derivative_block () const noexcept override {
9929  return true;
9930  }
9931 
9932  /**
9933  * \brief Return a copy of the current node
9934  *
9935  * Recursively make a new copy/clone of the current node including
9936  * all members and return a pointer to the node. This is used for
9937  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9938  * ast.
9939  *
9940  * @return pointer to the clone/copy of the current node
9941  */
9942  DerivativeBlock* clone() const override {
9943  return new DerivativeBlock(*this);
9944  }
9945 
9946  /// \name Getters
9947  /// \{
9948 
9949  /**
9950  * \brief Return type (ast::AstNodeType) of ast node
9951  *
9952  * Every node in the ast has a type defined in ast::AstNodeType and this
9953  * function is used to retrieve the same.
9954  *
9955  * \return ast node type i.e. ast::AstNodeType::DERIVATIVE_BLOCK
9956  *
9957  * \sa Ast::get_node_type_name
9958  */
9959  AstNodeType get_node_type() const noexcept override {
9961  }
9962 
9963  /**
9964  * \brief Return type (ast::AstNodeType) of ast node as std::string
9965  *
9966  * Every node in the ast has a type defined in ast::AstNodeType.
9967  * This type name can be returned as a std::string for printing
9968  * node to text/json form.
9969  *
9970  * \return name of the node type as a string i.e. "DerivativeBlock"
9971  *
9972  * \sa Ast::get_node_name
9973  */
9974  std::string get_node_type_name() const noexcept override {
9975  return "DerivativeBlock";
9976  }
9977 
9978  /**
9979  * \brief Return NMODL statement of ast node as std::string
9980  *
9981  * Every node is related to a special statement in the NMODL. This
9982  * statement can be returned as a std::string for printing to
9983  * text/json form.
9984  *
9985  * \return name of the statement as a string i.e. "DERIVATIVE "
9986  *
9987  * \sa Ast::get_nmodl_name
9988  */
9989  std::string get_nmodl_name() const noexcept override {
9990  return "DERIVATIVE ";
9991  }
9992 
9993  /**
9994  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9995  */
9996  std::shared_ptr<Ast> get_shared_ptr() override {
9997  return std::static_pointer_cast<DerivativeBlock>(shared_from_this());
9998  }
9999 
10000  /**
10001  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10002  */
10003  std::shared_ptr<const Ast> get_shared_ptr() const override {
10004  return std::static_pointer_cast<const DerivativeBlock>(shared_from_this());
10005  }
10006 
10007  /**
10008  * \brief Return associated token for the current ast node
10009  *
10010  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
10011  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
10012  * nullptr to store in the nmodl::symtab::SymbolTable.
10013  *
10014  * \return pointer to token if exist otherwise nullptr
10015  */
10016  const ModToken* get_token() const noexcept override {
10017  return token.get();
10018  }
10019 
10020  /**
10021  * \brief Return associated symbol table for the current ast node
10022  *
10023  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10024  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10025  * and it can be accessed using this method.
10026  *
10027  * \return pointer to the symbol table
10028  *
10029  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10030  */
10032  return symtab;
10033  }
10034 
10035 
10036 
10037 
10038 
10039 
10040 /**
10041  * \brief Return name of the node
10042  *
10043  * Some ast nodes have a member marked designated as node name. For example,
10044  * in case of this ast::Name has name designated as a
10045  * node name.
10046  *
10047  * @return name of the node as std::string
10048  *
10049  * \sa Ast::get_node_type_name
10050  */
10051 std::string get_node_name() const override;
10052 
10053 
10054  /**
10055  * \brief Getter for member variable \ref DerivativeBlock.name
10056  */
10057  const std::shared_ptr<Name>& get_name() const noexcept {
10058  return name;
10059  }
10060 
10061 
10062 
10063 
10064 
10065 
10066 
10067  /**
10068  * \brief Getter for member variable \ref DerivativeBlock.statement_block
10069  */
10070  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
10071  return statement_block;
10072  }
10073 
10074 
10075 
10076  /// \}
10077 
10078  /// \name Setters
10079  /// \{
10080 
10081 
10082  /**
10083  * \brief Set token for the current ast node
10084  */
10085  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
10086 
10087  /**
10088  * \brief Set symbol table for the current ast node
10089  *
10090  * Top level, block scoped nodes store symbol table in the ast node.
10091  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10092  * for every node in the ast.
10093  *
10094  * \sa nmodl::visitor::SymtabVisitor
10095  */
10096  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
10097  symtab = newsymtab;
10098  }
10099 
10100 
10101 
10102  /**
10103  * \brief Setter for member variable \ref DerivativeBlock.name (rvalue reference)
10104  */
10105  void set_name(std::shared_ptr<Name>&& name);
10106 
10107  /**
10108  * \brief Setter for member variable \ref DerivativeBlock.name
10109  */
10110  void set_name(const std::shared_ptr<Name>& name);
10111 
10112 
10113  /**
10114  * \brief Setter for member variable \ref DerivativeBlock.statement_block (rvalue reference)
10115  */
10116  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
10117 
10118  /**
10119  * \brief Setter for member variable \ref DerivativeBlock.statement_block
10120  */
10121  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
10122 
10123 
10124  /// \}
10125 
10126  /// \name Visitor
10127  /// \{
10128 
10129  /**
10130  * \brief visit children i.e. member variables of current node using provided visitor
10131  *
10132  * Different nodes in the AST have different members (i.e. children). This method
10133  * recursively visits children using provided visitor.
10134  *
10135  * \param v Concrete visitor that will be used to recursively visit children
10136  *
10137  * \sa Ast::visit_children for example.
10138  */
10139  void visit_children(visitor::Visitor& v) override;
10140 
10141  /**
10142  * \brief visit children i.e. member variables of current node using provided visitor
10143  *
10144  * Different nodes in the AST have different members (i.e. children). This method
10145  * recursively visits children using provided visitor.
10146  *
10147  * \param v Concrete constant visitor that will be used to recursively visit children
10148  *
10149  * \sa Ast::visit_children for example.
10150  */
10151  void visit_children(visitor::ConstVisitor& v) const override;
10152 
10153  /**
10154  * \brief accept (or visit) the current AST node using provided visitor
10155  *
10156  * Instead of visiting children of AST node, like Ast::visit_children,
10157  * accept allows to visit the current node itself using provided concrete
10158  * visitor.
10159  *
10160  * \param v Concrete visitor that will be used to recursively visit node
10161  *
10162  * \sa Ast::accept for example.
10163  */
10164  void accept(visitor::Visitor& v) override;
10165 
10166  /**
10167  * \copydoc accept(visitor::Visitor&)
10168  */
10169  void accept(visitor::ConstVisitor& v) const override;
10170 
10171  /// \}
10172 
10173 
10174 
10175  private:
10176  /**
10177  * \brief Set this object as parent for all the children
10178  *
10179  * This should be called in every object (with children) constructor
10180  * to set parents. Since it is called only in the constructors it
10181  * should not be virtual to avoid ambiguities (issue #295).
10182  */
10183  void set_parent_in_children();
10184 };
10185 
10186 /** @} */ // end of ast_class
10187 
10188 
10189 } // namespace ast
10190 } // namespace nmodl
10191 #endif // !NMODL_AST_DERIVATIVE_BLOCK_HPP
10192 #ifndef NMODL_AST_LINEAR_BLOCK_HPP
10193 #define NMODL_AST_LINEAR_BLOCK_HPP
10194 
10195 
10196 namespace nmodl {
10197 namespace ast {
10198 
10199 /**
10200  * @addtogroup ast_class
10201  * @ingroup ast
10202  * @{
10203  */
10204 
10205 /**
10206  * \brief Represents `LINEAR` block in the NMODL
10207  *
10208  *
10209  * A set of simultaneous equations can be specified in a `LINEAR` block.
10210  * Here is an example :
10211  *
10212  * \code{.mod}
10213  * LINEAR clamp {
10214  * LOCAL t1, t2
10215  * t1 = tau1/dt
10216  * t2 = tau2/dt
10217  * ~ vi = v + fac*vo - fac*v
10218  * ~ t2*vo - t2*vo0 + vo = -gain * e
10219  * ~ -stim - e + vi - e + t1*vi - t1*e - t1*(vi0 - e0) = 0
10220  * }
10221  * \endcode
10222  *
10223 */
10224 class LinearBlock : public Block {
10225  private:
10226  /// Name of the linear block
10227  std::shared_ptr<Name> name;
10228  /// TODO
10230  /// Block with statements vector
10231  std::shared_ptr<StatementBlock> statement_block;
10232  /// token with location information
10233  std::shared_ptr<ModToken> token;
10234  /// symbol table for a block
10235  symtab::SymbolTable* symtab = nullptr;
10236 
10237  public:
10238 
10239  /// \name Ctor & dtor
10240  /// \{
10241 
10242  explicit LinearBlock(Name* name, NameVector solvefor, StatementBlock* statement_block);
10243  explicit LinearBlock(const std::shared_ptr<Name>& name, const NameVector& solvefor, const std::shared_ptr<StatementBlock>& statement_block);
10244  LinearBlock(const LinearBlock& obj);
10245 
10246 
10247  virtual ~LinearBlock() = default;
10248 
10249  /// \}
10250 
10251 
10252 
10253 
10254 
10255 
10256  /**
10257  * \brief Check if the ast node is an instance of ast::LinearBlock
10258  * \return true as object is of type ast::LinearBlock
10259  */
10260  bool is_linear_block () const noexcept override {
10261  return true;
10262  }
10263 
10264  /**
10265  * \brief Return a copy of the current node
10266  *
10267  * Recursively make a new copy/clone of the current node including
10268  * all members and return a pointer to the node. This is used for
10269  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10270  * ast.
10271  *
10272  * @return pointer to the clone/copy of the current node
10273  */
10274  LinearBlock* clone() const override {
10275  return new LinearBlock(*this);
10276  }
10277 
10278  /// \name Getters
10279  /// \{
10280 
10281  /**
10282  * \brief Return type (ast::AstNodeType) of ast node
10283  *
10284  * Every node in the ast has a type defined in ast::AstNodeType and this
10285  * function is used to retrieve the same.
10286  *
10287  * \return ast node type i.e. ast::AstNodeType::LINEAR_BLOCK
10288  *
10289  * \sa Ast::get_node_type_name
10290  */
10291  AstNodeType get_node_type() const noexcept override {
10293  }
10294 
10295  /**
10296  * \brief Return type (ast::AstNodeType) of ast node as std::string
10297  *
10298  * Every node in the ast has a type defined in ast::AstNodeType.
10299  * This type name can be returned as a std::string for printing
10300  * node to text/json form.
10301  *
10302  * \return name of the node type as a string i.e. "LinearBlock"
10303  *
10304  * \sa Ast::get_node_name
10305  */
10306  std::string get_node_type_name() const noexcept override {
10307  return "LinearBlock";
10308  }
10309 
10310  /**
10311  * \brief Return NMODL statement of ast node as std::string
10312  *
10313  * Every node is related to a special statement in the NMODL. This
10314  * statement can be returned as a std::string for printing to
10315  * text/json form.
10316  *
10317  * \return name of the statement as a string i.e. "LINEAR "
10318  *
10319  * \sa Ast::get_nmodl_name
10320  */
10321  std::string get_nmodl_name() const noexcept override {
10322  return "LINEAR ";
10323  }
10324 
10325  /**
10326  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10327  */
10328  std::shared_ptr<Ast> get_shared_ptr() override {
10329  return std::static_pointer_cast<LinearBlock>(shared_from_this());
10330  }
10331 
10332  /**
10333  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10334  */
10335  std::shared_ptr<const Ast> get_shared_ptr() const override {
10336  return std::static_pointer_cast<const LinearBlock>(shared_from_this());
10337  }
10338 
10339  /**
10340  * \brief Return associated token for the current ast node
10341  *
10342  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
10343  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
10344  * nullptr to store in the nmodl::symtab::SymbolTable.
10345  *
10346  * \return pointer to token if exist otherwise nullptr
10347  */
10348  const ModToken* get_token() const noexcept override {
10349  return token.get();
10350  }
10351 
10352  /**
10353  * \brief Return associated symbol table for the current ast node
10354  *
10355  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10356  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10357  * and it can be accessed using this method.
10358  *
10359  * \return pointer to the symbol table
10360  *
10361  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10362  */
10364  return symtab;
10365  }
10366 
10367 
10368 
10369 
10370 
10371 
10372 /**
10373  * \brief Return name of the node
10374  *
10375  * Some ast nodes have a member marked designated as node name. For example,
10376  * in case of this ast::Name has name designated as a
10377  * node name.
10378  *
10379  * @return name of the node as std::string
10380  *
10381  * \sa Ast::get_node_type_name
10382  */
10383 std::string get_node_name() const override;
10384 
10385 
10386  /**
10387  * \brief Getter for member variable \ref LinearBlock.name
10388  */
10389  const std::shared_ptr<Name>& get_name() const noexcept {
10390  return name;
10391  }
10392 
10393 
10394 
10395 
10396 
10397 
10398 
10399  /**
10400  * \brief Getter for member variable \ref LinearBlock.solvefor
10401  */
10402  const NameVector& get_solvefor() const noexcept {
10403  return solvefor;
10404  }
10405 
10406 
10407 
10408 
10409 
10410 
10411 
10412  /**
10413  * \brief Getter for member variable \ref LinearBlock.statement_block
10414  */
10415  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
10416  return statement_block;
10417  }
10418 
10419 
10420 
10421  /// \}
10422 
10423  /// \name Setters
10424  /// \{
10425 
10426 
10427  /**
10428  * \brief Set token for the current ast node
10429  */
10430  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
10431 
10432  /**
10433  * \brief Set symbol table for the current ast node
10434  *
10435  * Top level, block scoped nodes store symbol table in the ast node.
10436  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10437  * for every node in the ast.
10438  *
10439  * \sa nmodl::visitor::SymtabVisitor
10440  */
10441  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
10442  symtab = newsymtab;
10443  }
10444 
10445 
10446 
10447  /**
10448  * \brief Setter for member variable \ref LinearBlock.name (rvalue reference)
10449  */
10450  void set_name(std::shared_ptr<Name>&& name);
10451 
10452  /**
10453  * \brief Setter for member variable \ref LinearBlock.name
10454  */
10455  void set_name(const std::shared_ptr<Name>& name);
10456 
10457 
10458  /**
10459  * \brief Setter for member variable \ref LinearBlock.solvefor (rvalue reference)
10460  */
10461  void set_solvefor(NameVector&& solvefor);
10462 
10463  /**
10464  * \brief Setter for member variable \ref LinearBlock.solvefor
10465  */
10466  void set_solvefor(const NameVector& solvefor);
10467 
10468 
10469  /**
10470  * \brief Setter for member variable \ref LinearBlock.statement_block (rvalue reference)
10471  */
10472  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
10473 
10474  /**
10475  * \brief Setter for member variable \ref LinearBlock.statement_block
10476  */
10477  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
10478 
10479 
10480  /// \}
10481 
10482  /// \name Visitor
10483  /// \{
10484 
10485  /**
10486  * \brief visit children i.e. member variables of current node using provided visitor
10487  *
10488  * Different nodes in the AST have different members (i.e. children). This method
10489  * recursively visits children using provided visitor.
10490  *
10491  * \param v Concrete visitor that will be used to recursively visit children
10492  *
10493  * \sa Ast::visit_children for example.
10494  */
10495  void visit_children(visitor::Visitor& v) override;
10496 
10497  /**
10498  * \brief visit children i.e. member variables of current node using provided visitor
10499  *
10500  * Different nodes in the AST have different members (i.e. children). This method
10501  * recursively visits children using provided visitor.
10502  *
10503  * \param v Concrete constant visitor that will be used to recursively visit children
10504  *
10505  * \sa Ast::visit_children for example.
10506  */
10507  void visit_children(visitor::ConstVisitor& v) const override;
10508 
10509  /**
10510  * \brief accept (or visit) the current AST node using provided visitor
10511  *
10512  * Instead of visiting children of AST node, like Ast::visit_children,
10513  * accept allows to visit the current node itself using provided concrete
10514  * visitor.
10515  *
10516  * \param v Concrete visitor that will be used to recursively visit node
10517  *
10518  * \sa Ast::accept for example.
10519  */
10520  void accept(visitor::Visitor& v) override;
10521 
10522  /**
10523  * \copydoc accept(visitor::Visitor&)
10524  */
10525  void accept(visitor::ConstVisitor& v) const override;
10526 
10527  /// \}
10528 
10529 
10530 
10531  private:
10532  /**
10533  * \brief Set this object as parent for all the children
10534  *
10535  * This should be called in every object (with children) constructor
10536  * to set parents. Since it is called only in the constructors it
10537  * should not be virtual to avoid ambiguities (issue #295).
10538  */
10539  void set_parent_in_children();
10540 };
10541 
10542 /** @} */ // end of ast_class
10543 
10544 
10545 } // namespace ast
10546 } // namespace nmodl
10547 #endif // !NMODL_AST_LINEAR_BLOCK_HPP
10548 #ifndef NMODL_AST_NON_LINEAR_BLOCK_HPP
10549 #define NMODL_AST_NON_LINEAR_BLOCK_HPP
10550 
10551 
10552 namespace nmodl {
10553 namespace ast {
10554 
10555 /**
10556  * @addtogroup ast_class
10557  * @ingroup ast
10558  * @{
10559  */
10560 
10561 /**
10562  * \brief Represents `NONLINEAR` block in the NMODL
10563  *
10564  *
10565  * A set of simultaneous equations can be specified in a `NONLINEAR` block.
10566  * Here is an example :
10567  *
10568  * \code{.mod}
10569  * NONLINEAR nonlin {
10570  * ~ s[0] = 1
10571  * ~ s[1] = 3
10572  * ~ s[2] + s[1] = s[0]
10573  * }
10574  * \endcode
10575  *
10576 */
10577 class NonLinearBlock : public Block {
10578  private:
10579  /// Name of the non-linear block
10580  std::shared_ptr<Name> name;
10581  /// Name of the integration method
10583  /// Block with statements vector
10584  std::shared_ptr<StatementBlock> statement_block;
10585  /// token with location information
10586  std::shared_ptr<ModToken> token;
10587  /// symbol table for a block
10588  symtab::SymbolTable* symtab = nullptr;
10589 
10590  public:
10591 
10592  /// \name Ctor & dtor
10593  /// \{
10594 
10595  explicit NonLinearBlock(Name* name, NameVector solvefor, StatementBlock* statement_block);
10596  explicit NonLinearBlock(const std::shared_ptr<Name>& name, const NameVector& solvefor, const std::shared_ptr<StatementBlock>& statement_block);
10597  NonLinearBlock(const NonLinearBlock& obj);
10598 
10599 
10600  virtual ~NonLinearBlock() = default;
10601 
10602  /// \}
10603 
10604 
10605 
10606 
10607 
10608 
10609  /**
10610  * \brief Check if the ast node is an instance of ast::NonLinearBlock
10611  * \return true as object is of type ast::NonLinearBlock
10612  */
10613  bool is_non_linear_block () const noexcept override {
10614  return true;
10615  }
10616 
10617  /**
10618  * \brief Return a copy of the current node
10619  *
10620  * Recursively make a new copy/clone of the current node including
10621  * all members and return a pointer to the node. This is used for
10622  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10623  * ast.
10624  *
10625  * @return pointer to the clone/copy of the current node
10626  */
10627  NonLinearBlock* clone() const override {
10628  return new NonLinearBlock(*this);
10629  }
10630 
10631  /// \name Getters
10632  /// \{
10633 
10634  /**
10635  * \brief Return type (ast::AstNodeType) of ast node
10636  *
10637  * Every node in the ast has a type defined in ast::AstNodeType and this
10638  * function is used to retrieve the same.
10639  *
10640  * \return ast node type i.e. ast::AstNodeType::NON_LINEAR_BLOCK
10641  *
10642  * \sa Ast::get_node_type_name
10643  */
10644  AstNodeType get_node_type() const noexcept override {
10646  }
10647 
10648  /**
10649  * \brief Return type (ast::AstNodeType) of ast node as std::string
10650  *
10651  * Every node in the ast has a type defined in ast::AstNodeType.
10652  * This type name can be returned as a std::string for printing
10653  * node to text/json form.
10654  *
10655  * \return name of the node type as a string i.e. "NonLinearBlock"
10656  *
10657  * \sa Ast::get_node_name
10658  */
10659  std::string get_node_type_name() const noexcept override {
10660  return "NonLinearBlock";
10661  }
10662 
10663  /**
10664  * \brief Return NMODL statement of ast node as std::string
10665  *
10666  * Every node is related to a special statement in the NMODL. This
10667  * statement can be returned as a std::string for printing to
10668  * text/json form.
10669  *
10670  * \return name of the statement as a string i.e. "NONLINEAR "
10671  *
10672  * \sa Ast::get_nmodl_name
10673  */
10674  std::string get_nmodl_name() const noexcept override {
10675  return "NONLINEAR ";
10676  }
10677 
10678  /**
10679  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10680  */
10681  std::shared_ptr<Ast> get_shared_ptr() override {
10682  return std::static_pointer_cast<NonLinearBlock>(shared_from_this());
10683  }
10684 
10685  /**
10686  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10687  */
10688  std::shared_ptr<const Ast> get_shared_ptr() const override {
10689  return std::static_pointer_cast<const NonLinearBlock>(shared_from_this());
10690  }
10691 
10692  /**
10693  * \brief Return associated token for the current ast node
10694  *
10695  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
10696  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
10697  * nullptr to store in the nmodl::symtab::SymbolTable.
10698  *
10699  * \return pointer to token if exist otherwise nullptr
10700  */
10701  const ModToken* get_token() const noexcept override {
10702  return token.get();
10703  }
10704 
10705  /**
10706  * \brief Return associated symbol table for the current ast node
10707  *
10708  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10709  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10710  * and it can be accessed using this method.
10711  *
10712  * \return pointer to the symbol table
10713  *
10714  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10715  */
10717  return symtab;
10718  }
10719 
10720 
10721 
10722 
10723 
10724 
10725 /**
10726  * \brief Return name of the node
10727  *
10728  * Some ast nodes have a member marked designated as node name. For example,
10729  * in case of this ast::Name has name designated as a
10730  * node name.
10731  *
10732  * @return name of the node as std::string
10733  *
10734  * \sa Ast::get_node_type_name
10735  */
10736 std::string get_node_name() const override;
10737 
10738 
10739  /**
10740  * \brief Getter for member variable \ref NonLinearBlock.name
10741  */
10742  const std::shared_ptr<Name>& get_name() const noexcept {
10743  return name;
10744  }
10745 
10746 
10747 
10748 
10749 
10750 
10751 
10752  /**
10753  * \brief Getter for member variable \ref NonLinearBlock.solvefor
10754  */
10755  const NameVector& get_solvefor() const noexcept {
10756  return solvefor;
10757  }
10758 
10759 
10760 
10761 
10762 
10763 
10764 
10765  /**
10766  * \brief Getter for member variable \ref NonLinearBlock.statement_block
10767  */
10768  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
10769  return statement_block;
10770  }
10771 
10772 
10773 
10774  /// \}
10775 
10776  /// \name Setters
10777  /// \{
10778 
10779 
10780  /**
10781  * \brief Set token for the current ast node
10782  */
10783  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
10784 
10785  /**
10786  * \brief Set symbol table for the current ast node
10787  *
10788  * Top level, block scoped nodes store symbol table in the ast node.
10789  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10790  * for every node in the ast.
10791  *
10792  * \sa nmodl::visitor::SymtabVisitor
10793  */
10794  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
10795  symtab = newsymtab;
10796  }
10797 
10798 
10799 
10800  /**
10801  * \brief Setter for member variable \ref NonLinearBlock.name (rvalue reference)
10802  */
10803  void set_name(std::shared_ptr<Name>&& name);
10804 
10805  /**
10806  * \brief Setter for member variable \ref NonLinearBlock.name
10807  */
10808  void set_name(const std::shared_ptr<Name>& name);
10809 
10810 
10811  /**
10812  * \brief Setter for member variable \ref NonLinearBlock.solvefor (rvalue reference)
10813  */
10814  void set_solvefor(NameVector&& solvefor);
10815 
10816  /**
10817  * \brief Setter for member variable \ref NonLinearBlock.solvefor
10818  */
10819  void set_solvefor(const NameVector& solvefor);
10820 
10821 
10822  /**
10823  * \brief Setter for member variable \ref NonLinearBlock.statement_block (rvalue reference)
10824  */
10825  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
10826 
10827  /**
10828  * \brief Setter for member variable \ref NonLinearBlock.statement_block
10829  */
10830  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
10831 
10832 
10833  /// \}
10834 
10835  /// \name Visitor
10836  /// \{
10837 
10838  /**
10839  * \brief visit children i.e. member variables of current node using provided visitor
10840  *
10841  * Different nodes in the AST have different members (i.e. children). This method
10842  * recursively visits children using provided visitor.
10843  *
10844  * \param v Concrete visitor that will be used to recursively visit children
10845  *
10846  * \sa Ast::visit_children for example.
10847  */
10848  void visit_children(visitor::Visitor& v) override;
10849 
10850  /**
10851  * \brief visit children i.e. member variables of current node using provided visitor
10852  *
10853  * Different nodes in the AST have different members (i.e. children). This method
10854  * recursively visits children using provided visitor.
10855  *
10856  * \param v Concrete constant visitor that will be used to recursively visit children
10857  *
10858  * \sa Ast::visit_children for example.
10859  */
10860  void visit_children(visitor::ConstVisitor& v) const override;
10861 
10862  /**
10863  * \brief accept (or visit) the current AST node using provided visitor
10864  *
10865  * Instead of visiting children of AST node, like Ast::visit_children,
10866  * accept allows to visit the current node itself using provided concrete
10867  * visitor.
10868  *
10869  * \param v Concrete visitor that will be used to recursively visit node
10870  *
10871  * \sa Ast::accept for example.
10872  */
10873  void accept(visitor::Visitor& v) override;
10874 
10875  /**
10876  * \copydoc accept(visitor::Visitor&)
10877  */
10878  void accept(visitor::ConstVisitor& v) const override;
10879 
10880  /// \}
10881 
10882 
10883 
10884  private:
10885  /**
10886  * \brief Set this object as parent for all the children
10887  *
10888  * This should be called in every object (with children) constructor
10889  * to set parents. Since it is called only in the constructors it
10890  * should not be virtual to avoid ambiguities (issue #295).
10891  */
10892  void set_parent_in_children();
10893 };
10894 
10895 /** @} */ // end of ast_class
10896 
10897 
10898 } // namespace ast
10899 } // namespace nmodl
10900 #endif // !NMODL_AST_NON_LINEAR_BLOCK_HPP
10901 #ifndef NMODL_AST_DISCRETE_BLOCK_HPP
10902 #define NMODL_AST_DISCRETE_BLOCK_HPP
10903 
10904 
10905 namespace nmodl {
10906 namespace ast {
10907 
10908 /**
10909  * @addtogroup ast_class
10910  * @ingroup ast
10911  * @{
10912  */
10913 
10914 /**
10915  * \brief TODO
10916  *
10917  *
10918 */
10919 class DiscreteBlock : public Block {
10920  private:
10921  /// Name of the discrete block
10922  std::shared_ptr<Name> name;
10923  /// Block with statements vector
10924  std::shared_ptr<StatementBlock> statement_block;
10925  /// token with location information
10926  std::shared_ptr<ModToken> token;
10927  /// symbol table for a block
10928  symtab::SymbolTable* symtab = nullptr;
10929 
10930  public:
10931 
10932  /// \name Ctor & dtor
10933  /// \{
10934 
10935  explicit DiscreteBlock(Name* name, StatementBlock* statement_block);
10936  explicit DiscreteBlock(const std::shared_ptr<Name>& name, const std::shared_ptr<StatementBlock>& statement_block);
10937  DiscreteBlock(const DiscreteBlock& obj);
10938 
10939 
10940  virtual ~DiscreteBlock() = default;
10941 
10942  /// \}
10943 
10944 
10945 
10946 
10947 
10948 
10949  /**
10950  * \brief Check if the ast node is an instance of ast::DiscreteBlock
10951  * \return true as object is of type ast::DiscreteBlock
10952  */
10953  bool is_discrete_block () const noexcept override {
10954  return true;
10955  }
10956 
10957  /**
10958  * \brief Return a copy of the current node
10959  *
10960  * Recursively make a new copy/clone of the current node including
10961  * all members and return a pointer to the node. This is used for
10962  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10963  * ast.
10964  *
10965  * @return pointer to the clone/copy of the current node
10966  */
10967  DiscreteBlock* clone() const override {
10968  return new DiscreteBlock(*this);
10969  }
10970 
10971  /// \name Getters
10972  /// \{
10973 
10974  /**
10975  * \brief Return type (ast::AstNodeType) of ast node
10976  *
10977  * Every node in the ast has a type defined in ast::AstNodeType and this
10978  * function is used to retrieve the same.
10979  *
10980  * \return ast node type i.e. ast::AstNodeType::DISCRETE_BLOCK
10981  *
10982  * \sa Ast::get_node_type_name
10983  */
10984  AstNodeType get_node_type() const noexcept override {
10986  }
10987 
10988  /**
10989  * \brief Return type (ast::AstNodeType) of ast node as std::string
10990  *
10991  * Every node in the ast has a type defined in ast::AstNodeType.
10992  * This type name can be returned as a std::string for printing
10993  * node to text/json form.
10994  *
10995  * \return name of the node type as a string i.e. "DiscreteBlock"
10996  *
10997  * \sa Ast::get_node_name
10998  */
10999  std::string get_node_type_name() const noexcept override {
11000  return "DiscreteBlock";
11001  }
11002 
11003  /**
11004  * \brief Return NMODL statement of ast node as std::string
11005  *
11006  * Every node is related to a special statement in the NMODL. This
11007  * statement can be returned as a std::string for printing to
11008  * text/json form.
11009  *
11010  * \return name of the statement as a string i.e. "DISCRETE "
11011  *
11012  * \sa Ast::get_nmodl_name
11013  */
11014  std::string get_nmodl_name() const noexcept override {
11015  return "DISCRETE ";
11016  }
11017 
11018  /**
11019  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11020  */
11021  std::shared_ptr<Ast> get_shared_ptr() override {
11022  return std::static_pointer_cast<DiscreteBlock>(shared_from_this());
11023  }
11024 
11025  /**
11026  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11027  */
11028  std::shared_ptr<const Ast> get_shared_ptr() const override {
11029  return std::static_pointer_cast<const DiscreteBlock>(shared_from_this());
11030  }
11031 
11032  /**
11033  * \brief Return associated token for the current ast node
11034  *
11035  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
11036  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
11037  * nullptr to store in the nmodl::symtab::SymbolTable.
11038  *
11039  * \return pointer to token if exist otherwise nullptr
11040  */
11041  const ModToken* get_token() const noexcept override {
11042  return token.get();
11043  }
11044 
11045  /**
11046  * \brief Return associated symbol table for the current ast node
11047  *
11048  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11049  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11050  * and it can be accessed using this method.
11051  *
11052  * \return pointer to the symbol table
11053  *
11054  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11055  */
11057  return symtab;
11058  }
11059 
11060 
11061 
11062 
11063 
11064 
11065 /**
11066  * \brief Return name of the node
11067  *
11068  * Some ast nodes have a member marked designated as node name. For example,
11069  * in case of this ast::Name has name designated as a
11070  * node name.
11071  *
11072  * @return name of the node as std::string
11073  *
11074  * \sa Ast::get_node_type_name
11075  */
11076 std::string get_node_name() const override;
11077 
11078 
11079  /**
11080  * \brief Getter for member variable \ref DiscreteBlock.name
11081  */
11082  const std::shared_ptr<Name>& get_name() const noexcept {
11083  return name;
11084  }
11085 
11086 
11087 
11088 
11089 
11090 
11091 
11092  /**
11093  * \brief Getter for member variable \ref DiscreteBlock.statement_block
11094  */
11095  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
11096  return statement_block;
11097  }
11098 
11099 
11100 
11101  /// \}
11102 
11103  /// \name Setters
11104  /// \{
11105 
11106 
11107  /**
11108  * \brief Set token for the current ast node
11109  */
11110  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
11111 
11112  /**
11113  * \brief Set symbol table for the current ast node
11114  *
11115  * Top level, block scoped nodes store symbol table in the ast node.
11116  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11117  * for every node in the ast.
11118  *
11119  * \sa nmodl::visitor::SymtabVisitor
11120  */
11121  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
11122  symtab = newsymtab;
11123  }
11124 
11125 
11126 
11127  /**
11128  * \brief Setter for member variable \ref DiscreteBlock.name (rvalue reference)
11129  */
11130  void set_name(std::shared_ptr<Name>&& name);
11131 
11132  /**
11133  * \brief Setter for member variable \ref DiscreteBlock.name
11134  */
11135  void set_name(const std::shared_ptr<Name>& name);
11136 
11137 
11138  /**
11139  * \brief Setter for member variable \ref DiscreteBlock.statement_block (rvalue reference)
11140  */
11141  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
11142 
11143  /**
11144  * \brief Setter for member variable \ref DiscreteBlock.statement_block
11145  */
11146  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
11147 
11148 
11149  /// \}
11150 
11151  /// \name Visitor
11152  /// \{
11153 
11154  /**
11155  * \brief visit children i.e. member variables of current node using provided visitor
11156  *
11157  * Different nodes in the AST have different members (i.e. children). This method
11158  * recursively visits children using provided visitor.
11159  *
11160  * \param v Concrete visitor that will be used to recursively visit children
11161  *
11162  * \sa Ast::visit_children for example.
11163  */
11164  void visit_children(visitor::Visitor& v) override;
11165 
11166  /**
11167  * \brief visit children i.e. member variables of current node using provided visitor
11168  *
11169  * Different nodes in the AST have different members (i.e. children). This method
11170  * recursively visits children using provided visitor.
11171  *
11172  * \param v Concrete constant visitor that will be used to recursively visit children
11173  *
11174  * \sa Ast::visit_children for example.
11175  */
11176  void visit_children(visitor::ConstVisitor& v) const override;
11177 
11178  /**
11179  * \brief accept (or visit) the current AST node using provided visitor
11180  *
11181  * Instead of visiting children of AST node, like Ast::visit_children,
11182  * accept allows to visit the current node itself using provided concrete
11183  * visitor.
11184  *
11185  * \param v Concrete visitor that will be used to recursively visit node
11186  *
11187  * \sa Ast::accept for example.
11188  */
11189  void accept(visitor::Visitor& v) override;
11190 
11191  /**
11192  * \copydoc accept(visitor::Visitor&)
11193  */
11194  void accept(visitor::ConstVisitor& v) const override;
11195 
11196  /// \}
11197 
11198 
11199 
11200  private:
11201  /**
11202  * \brief Set this object as parent for all the children
11203  *
11204  * This should be called in every object (with children) constructor
11205  * to set parents. Since it is called only in the constructors it
11206  * should not be virtual to avoid ambiguities (issue #295).
11207  */
11208  void set_parent_in_children();
11209 };
11210 
11211 /** @} */ // end of ast_class
11212 
11213 
11214 } // namespace ast
11215 } // namespace nmodl
11216 #endif // !NMODL_AST_DISCRETE_BLOCK_HPP
11217 #ifndef NMODL_AST_PARTIAL_BLOCK_HPP
11218 #define NMODL_AST_PARTIAL_BLOCK_HPP
11219 
11220 
11221 namespace nmodl {
11222 namespace ast {
11223 
11224 /**
11225  * @addtogroup ast_class
11226  * @ingroup ast
11227  * @{
11228  */
11229 
11230 /**
11231  * \brief TODO
11232  *
11233  *
11234 */
11235 class PartialBlock : public Block {
11236  private:
11237  /// Name of the partial block
11238  std::shared_ptr<Name> name;
11239  /// Block with statements vector
11240  std::shared_ptr<StatementBlock> statement_block;
11241  /// token with location information
11242  std::shared_ptr<ModToken> token;
11243  /// symbol table for a block
11244  symtab::SymbolTable* symtab = nullptr;
11245 
11246  public:
11247 
11248  /// \name Ctor & dtor
11249  /// \{
11250 
11251  explicit PartialBlock(Name* name, StatementBlock* statement_block);
11252  explicit PartialBlock(const std::shared_ptr<Name>& name, const std::shared_ptr<StatementBlock>& statement_block);
11253  PartialBlock(const PartialBlock& obj);
11254 
11255 
11256  virtual ~PartialBlock() = default;
11257 
11258  /// \}
11259 
11260 
11261 
11262 
11263 
11264 
11265  /**
11266  * \brief Check if the ast node is an instance of ast::PartialBlock
11267  * \return true as object is of type ast::PartialBlock
11268  */
11269  bool is_partial_block () const noexcept override {
11270  return true;
11271  }
11272 
11273  /**
11274  * \brief Return a copy of the current node
11275  *
11276  * Recursively make a new copy/clone of the current node including
11277  * all members and return a pointer to the node. This is used for
11278  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11279  * ast.
11280  *
11281  * @return pointer to the clone/copy of the current node
11282  */
11283  PartialBlock* clone() const override {
11284  return new PartialBlock(*this);
11285  }
11286 
11287  /// \name Getters
11288  /// \{
11289 
11290  /**
11291  * \brief Return type (ast::AstNodeType) of ast node
11292  *
11293  * Every node in the ast has a type defined in ast::AstNodeType and this
11294  * function is used to retrieve the same.
11295  *
11296  * \return ast node type i.e. ast::AstNodeType::PARTIAL_BLOCK
11297  *
11298  * \sa Ast::get_node_type_name
11299  */
11300  AstNodeType get_node_type() const noexcept override {
11302  }
11303 
11304  /**
11305  * \brief Return type (ast::AstNodeType) of ast node as std::string
11306  *
11307  * Every node in the ast has a type defined in ast::AstNodeType.
11308  * This type name can be returned as a std::string for printing
11309  * node to text/json form.
11310  *
11311  * \return name of the node type as a string i.e. "PartialBlock"
11312  *
11313  * \sa Ast::get_node_name
11314  */
11315  std::string get_node_type_name() const noexcept override {
11316  return "PartialBlock";
11317  }
11318 
11319  /**
11320  * \brief Return NMODL statement of ast node as std::string
11321  *
11322  * Every node is related to a special statement in the NMODL. This
11323  * statement can be returned as a std::string for printing to
11324  * text/json form.
11325  *
11326  * \return name of the statement as a string i.e. "PARTIAL "
11327  *
11328  * \sa Ast::get_nmodl_name
11329  */
11330  std::string get_nmodl_name() const noexcept override {
11331  return "PARTIAL ";
11332  }
11333 
11334  /**
11335  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11336  */
11337  std::shared_ptr<Ast> get_shared_ptr() override {
11338  return std::static_pointer_cast<PartialBlock>(shared_from_this());
11339  }
11340 
11341  /**
11342  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11343  */
11344  std::shared_ptr<const Ast> get_shared_ptr() const override {
11345  return std::static_pointer_cast<const PartialBlock>(shared_from_this());
11346  }
11347 
11348  /**
11349  * \brief Return associated token for the current ast node
11350  *
11351  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
11352  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
11353  * nullptr to store in the nmodl::symtab::SymbolTable.
11354  *
11355  * \return pointer to token if exist otherwise nullptr
11356  */
11357  const ModToken* get_token() const noexcept override {
11358  return token.get();
11359  }
11360 
11361  /**
11362  * \brief Return associated symbol table for the current ast node
11363  *
11364  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11365  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11366  * and it can be accessed using this method.
11367  *
11368  * \return pointer to the symbol table
11369  *
11370  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11371  */
11373  return symtab;
11374  }
11375 
11376 
11377 
11378 
11379 
11380 
11381 /**
11382  * \brief Return name of the node
11383  *
11384  * Some ast nodes have a member marked designated as node name. For example,
11385  * in case of this ast::Name has name designated as a
11386  * node name.
11387  *
11388  * @return name of the node as std::string
11389  *
11390  * \sa Ast::get_node_type_name
11391  */
11392 std::string get_node_name() const override;
11393 
11394 
11395  /**
11396  * \brief Getter for member variable \ref PartialBlock.name
11397  */
11398  const std::shared_ptr<Name>& get_name() const noexcept {
11399  return name;
11400  }
11401 
11402 
11403 
11404 
11405 
11406 
11407 
11408  /**
11409  * \brief Getter for member variable \ref PartialBlock.statement_block
11410  */
11411  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
11412  return statement_block;
11413  }
11414 
11415 
11416 
11417  /// \}
11418 
11419  /// \name Setters
11420  /// \{
11421 
11422 
11423  /**
11424  * \brief Set token for the current ast node
11425  */
11426  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
11427 
11428  /**
11429  * \brief Set symbol table for the current ast node
11430  *
11431  * Top level, block scoped nodes store symbol table in the ast node.
11432  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11433  * for every node in the ast.
11434  *
11435  * \sa nmodl::visitor::SymtabVisitor
11436  */
11437  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
11438  symtab = newsymtab;
11439  }
11440 
11441 
11442 
11443  /**
11444  * \brief Setter for member variable \ref PartialBlock.name (rvalue reference)
11445  */
11446  void set_name(std::shared_ptr<Name>&& name);
11447 
11448  /**
11449  * \brief Setter for member variable \ref PartialBlock.name
11450  */
11451  void set_name(const std::shared_ptr<Name>& name);
11452 
11453 
11454  /**
11455  * \brief Setter for member variable \ref PartialBlock.statement_block (rvalue reference)
11456  */
11457  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
11458 
11459  /**
11460  * \brief Setter for member variable \ref PartialBlock.statement_block
11461  */
11462  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
11463 
11464 
11465  /// \}
11466 
11467  /// \name Visitor
11468  /// \{
11469 
11470  /**
11471  * \brief visit children i.e. member variables of current node using provided visitor
11472  *
11473  * Different nodes in the AST have different members (i.e. children). This method
11474  * recursively visits children using provided visitor.
11475  *
11476  * \param v Concrete visitor that will be used to recursively visit children
11477  *
11478  * \sa Ast::visit_children for example.
11479  */
11480  void visit_children(visitor::Visitor& v) override;
11481 
11482  /**
11483  * \brief visit children i.e. member variables of current node using provided visitor
11484  *
11485  * Different nodes in the AST have different members (i.e. children). This method
11486  * recursively visits children using provided visitor.
11487  *
11488  * \param v Concrete constant visitor that will be used to recursively visit children
11489  *
11490  * \sa Ast::visit_children for example.
11491  */
11492  void visit_children(visitor::ConstVisitor& v) const override;
11493 
11494  /**
11495  * \brief accept (or visit) the current AST node using provided visitor
11496  *
11497  * Instead of visiting children of AST node, like Ast::visit_children,
11498  * accept allows to visit the current node itself using provided concrete
11499  * visitor.
11500  *
11501  * \param v Concrete visitor that will be used to recursively visit node
11502  *
11503  * \sa Ast::accept for example.
11504  */
11505  void accept(visitor::Visitor& v) override;
11506 
11507  /**
11508  * \copydoc accept(visitor::Visitor&)
11509  */
11510  void accept(visitor::ConstVisitor& v) const override;
11511 
11512  /// \}
11513 
11514 
11515 
11516  private:
11517  /**
11518  * \brief Set this object as parent for all the children
11519  *
11520  * This should be called in every object (with children) constructor
11521  * to set parents. Since it is called only in the constructors it
11522  * should not be virtual to avoid ambiguities (issue #295).
11523  */
11524  void set_parent_in_children();
11525 };
11526 
11527 /** @} */ // end of ast_class
11528 
11529 
11530 } // namespace ast
11531 } // namespace nmodl
11532 #endif // !NMODL_AST_PARTIAL_BLOCK_HPP
11533 #ifndef NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
11534 #define NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
11535 
11536 
11537 namespace nmodl {
11538 namespace ast {
11539 
11540 /**
11541  * @addtogroup ast_class
11542  * @ingroup ast
11543  * @{
11544  */
11545 
11546 /**
11547  * \brief TODO
11548  *
11549  *
11550 */
11551 class FunctionTableBlock : public Block {
11552  private:
11553  /// Name of the function table block
11554  std::shared_ptr<Name> name;
11555  /// Vector of the parameters
11557  /// Unit if specified
11558  std::shared_ptr<Unit> unit;
11559  /// token with location information
11560  std::shared_ptr<ModToken> token;
11561  /// symbol table for a block
11562  symtab::SymbolTable* symtab = nullptr;
11563 
11564  public:
11565 
11566  /// \name Ctor & dtor
11567  /// \{
11568 
11569  explicit FunctionTableBlock(Name* name, ArgumentVector parameters, Unit* unit);
11570  explicit FunctionTableBlock(const std::shared_ptr<Name>& name, const ArgumentVector& parameters, const std::shared_ptr<Unit>& unit);
11572 
11573 
11574  virtual ~FunctionTableBlock() = default;
11575 
11576  /// \}
11577 
11578 
11579 
11580 
11581 
11582 
11583  /**
11584  * \brief Check if the ast node is an instance of ast::FunctionTableBlock
11585  * \return true as object is of type ast::FunctionTableBlock
11586  */
11587  bool is_function_table_block () const noexcept override {
11588  return true;
11589  }
11590 
11591  /**
11592  * \brief Return a copy of the current node
11593  *
11594  * Recursively make a new copy/clone of the current node including
11595  * all members and return a pointer to the node. This is used for
11596  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11597  * ast.
11598  *
11599  * @return pointer to the clone/copy of the current node
11600  */
11601  FunctionTableBlock* clone() const override {
11602  return new FunctionTableBlock(*this);
11603  }
11604 
11605  /// \name Getters
11606  /// \{
11607 
11608  /**
11609  * \brief Return type (ast::AstNodeType) of ast node
11610  *
11611  * Every node in the ast has a type defined in ast::AstNodeType and this
11612  * function is used to retrieve the same.
11613  *
11614  * \return ast node type i.e. ast::AstNodeType::FUNCTION_TABLE_BLOCK
11615  *
11616  * \sa Ast::get_node_type_name
11617  */
11618  AstNodeType get_node_type() const noexcept override {
11620  }
11621 
11622  /**
11623  * \brief Return type (ast::AstNodeType) of ast node as std::string
11624  *
11625  * Every node in the ast has a type defined in ast::AstNodeType.
11626  * This type name can be returned as a std::string for printing
11627  * node to text/json form.
11628  *
11629  * \return name of the node type as a string i.e. "FunctionTableBlock"
11630  *
11631  * \sa Ast::get_node_name
11632  */
11633  std::string get_node_type_name() const noexcept override {
11634  return "FunctionTableBlock";
11635  }
11636 
11637  /**
11638  * \brief Return NMODL statement of ast node as std::string
11639  *
11640  * Every node is related to a special statement in the NMODL. This
11641  * statement can be returned as a std::string for printing to
11642  * text/json form.
11643  *
11644  * \return name of the statement as a string i.e. "FUNCTION_TABLE "
11645  *
11646  * \sa Ast::get_nmodl_name
11647  */
11648  std::string get_nmodl_name() const noexcept override {
11649  return "FUNCTION_TABLE ";
11650  }
11651 
11652  /**
11653  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11654  */
11655  std::shared_ptr<Ast> get_shared_ptr() override {
11656  return std::static_pointer_cast<FunctionTableBlock>(shared_from_this());
11657  }
11658 
11659  /**
11660  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11661  */
11662  std::shared_ptr<const Ast> get_shared_ptr() const override {
11663  return std::static_pointer_cast<const FunctionTableBlock>(shared_from_this());
11664  }
11665 
11666  /**
11667  * \brief Return associated token for the current ast node
11668  *
11669  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
11670  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
11671  * nullptr to store in the nmodl::symtab::SymbolTable.
11672  *
11673  * \return pointer to token if exist otherwise nullptr
11674  */
11675  const ModToken* get_token() const noexcept override {
11676  return token.get();
11677  }
11678 
11679  /**
11680  * \brief Return associated symbol table for the current ast node
11681  *
11682  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11683  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11684  * and it can be accessed using this method.
11685  *
11686  * \return pointer to the symbol table
11687  *
11688  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11689  */
11691  return symtab;
11692  }
11693 
11694 
11695 
11696 
11697 
11698 
11699 /**
11700  * \brief Return name of the node
11701  *
11702  * Some ast nodes have a member marked designated as node name. For example,
11703  * in case of this ast::Name has name designated as a
11704  * node name.
11705  *
11706  * @return name of the node as std::string
11707  *
11708  * \sa Ast::get_node_type_name
11709  */
11710 std::string get_node_name() const override;
11711 
11712 
11713  /**
11714  * \brief Getter for member variable \ref FunctionTableBlock.name
11715  */
11716  const std::shared_ptr<Name>& get_name() const noexcept {
11717  return name;
11718  }
11719 
11720 
11721 
11722 
11723 
11724 
11725 
11726  /**
11727  * \brief Getter for member variable \ref FunctionTableBlock.parameters
11728  */
11729  const ArgumentVector& get_parameters() const noexcept override {
11730  return parameters;
11731  }
11732 
11733 
11734 
11735 
11736 
11737 
11738 
11739  /**
11740  * \brief Getter for member variable \ref FunctionTableBlock.unit
11741  */
11742  const std::shared_ptr<Unit>& get_unit() const noexcept {
11743  return unit;
11744  }
11745 
11746 
11747 
11748  /// \}
11749 
11750  /// \name Setters
11751  /// \{
11752 
11753 
11754  /**
11755  * \brief Set token for the current ast node
11756  */
11757  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
11758 
11759  /**
11760  * \brief Set symbol table for the current ast node
11761  *
11762  * Top level, block scoped nodes store symbol table in the ast node.
11763  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11764  * for every node in the ast.
11765  *
11766  * \sa nmodl::visitor::SymtabVisitor
11767  */
11768  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
11769  symtab = newsymtab;
11770  }
11771 
11772 
11773 
11774  /**
11775  * \brief Setter for member variable \ref FunctionTableBlock.name (rvalue reference)
11776  */
11777  void set_name(std::shared_ptr<Name>&& name);
11778 
11779  /**
11780  * \brief Setter for member variable \ref FunctionTableBlock.name
11781  */
11782  void set_name(const std::shared_ptr<Name>& name);
11783 
11784 
11785  /**
11786  * \brief Setter for member variable \ref FunctionTableBlock.parameters (rvalue reference)
11787  */
11788  void set_parameters(ArgumentVector&& parameters);
11789 
11790  /**
11791  * \brief Setter for member variable \ref FunctionTableBlock.parameters
11792  */
11793  void set_parameters(const ArgumentVector& parameters);
11794 
11795 
11796  /**
11797  * \brief Setter for member variable \ref FunctionTableBlock.unit (rvalue reference)
11798  */
11799  void set_unit(std::shared_ptr<Unit>&& unit);
11800 
11801  /**
11802  * \brief Setter for member variable \ref FunctionTableBlock.unit
11803  */
11804  void set_unit(const std::shared_ptr<Unit>& unit);
11805 
11806 
11807  /// \}
11808 
11809  /// \name Visitor
11810  /// \{
11811 
11812  /**
11813  * \brief visit children i.e. member variables of current node using provided visitor
11814  *
11815  * Different nodes in the AST have different members (i.e. children). This method
11816  * recursively visits children using provided visitor.
11817  *
11818  * \param v Concrete visitor that will be used to recursively visit children
11819  *
11820  * \sa Ast::visit_children for example.
11821  */
11822  void visit_children(visitor::Visitor& v) override;
11823 
11824  /**
11825  * \brief visit children i.e. member variables of current node using provided visitor
11826  *
11827  * Different nodes in the AST have different members (i.e. children). This method
11828  * recursively visits children using provided visitor.
11829  *
11830  * \param v Concrete constant visitor that will be used to recursively visit children
11831  *
11832  * \sa Ast::visit_children for example.
11833  */
11834  void visit_children(visitor::ConstVisitor& v) const override;
11835 
11836  /**
11837  * \brief accept (or visit) the current AST node using provided visitor
11838  *
11839  * Instead of visiting children of AST node, like Ast::visit_children,
11840  * accept allows to visit the current node itself using provided concrete
11841  * visitor.
11842  *
11843  * \param v Concrete visitor that will be used to recursively visit node
11844  *
11845  * \sa Ast::accept for example.
11846  */
11847  void accept(visitor::Visitor& v) override;
11848 
11849  /**
11850  * \copydoc accept(visitor::Visitor&)
11851  */
11852  void accept(visitor::ConstVisitor& v) const override;
11853 
11854  /// \}
11855 
11856 
11857 
11858  private:
11859  /**
11860  * \brief Set this object as parent for all the children
11861  *
11862  * This should be called in every object (with children) constructor
11863  * to set parents. Since it is called only in the constructors it
11864  * should not be virtual to avoid ambiguities (issue #295).
11865  */
11866  void set_parent_in_children();
11867 };
11868 
11869 /** @} */ // end of ast_class
11870 
11871 
11872 } // namespace ast
11873 } // namespace nmodl
11874 #endif // !NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
11875 #ifndef NMODL_AST_FUNCTION_BLOCK_HPP
11876 #define NMODL_AST_FUNCTION_BLOCK_HPP
11877 
11878 
11879 namespace nmodl {
11880 namespace ast {
11881 
11882 /**
11883  * @addtogroup ast_class
11884  * @ingroup ast
11885  * @{
11886  */
11887 
11888 /**
11889  * \brief TODO
11890  *
11891  *
11892 */
11893 class FunctionBlock : public Block {
11894  private:
11895  /// Name of the function
11896  std::shared_ptr<Name> name;
11897  /// Vector of the parameters
11899  /// Unit if specified
11900  std::shared_ptr<Unit> unit;
11901  /// Block with statements vector
11902  std::shared_ptr<StatementBlock> statement_block;
11903  /// token with location information
11904  std::shared_ptr<ModToken> token;
11905  /// symbol table for a block
11906  symtab::SymbolTable* symtab = nullptr;
11907 
11908  public:
11909 
11910  /// \name Ctor & dtor
11911  /// \{
11912 
11913  explicit FunctionBlock(Name* name, ArgumentVector parameters, Unit* unit, StatementBlock* statement_block);
11914  explicit FunctionBlock(const std::shared_ptr<Name>& name, const ArgumentVector& parameters, const std::shared_ptr<Unit>& unit, const std::shared_ptr<StatementBlock>& statement_block);
11915  FunctionBlock(const FunctionBlock& obj);
11916 
11917 
11918  virtual ~FunctionBlock() = default;
11919 
11920  /// \}
11921 
11922 
11923 
11924 
11925 
11926 
11927  /**
11928  * \brief Check if the ast node is an instance of ast::FunctionBlock
11929  * \return true as object is of type ast::FunctionBlock
11930  */
11931  bool is_function_block () const noexcept override {
11932  return true;
11933  }
11934 
11935  /**
11936  * \brief Return a copy of the current node
11937  *
11938  * Recursively make a new copy/clone of the current node including
11939  * all members and return a pointer to the node. This is used for
11940  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11941  * ast.
11942  *
11943  * @return pointer to the clone/copy of the current node
11944  */
11945  FunctionBlock* clone() const override {
11946  return new FunctionBlock(*this);
11947  }
11948 
11949  /// \name Getters
11950  /// \{
11951 
11952  /**
11953  * \brief Return type (ast::AstNodeType) of ast node
11954  *
11955  * Every node in the ast has a type defined in ast::AstNodeType and this
11956  * function is used to retrieve the same.
11957  *
11958  * \return ast node type i.e. ast::AstNodeType::FUNCTION_BLOCK
11959  *
11960  * \sa Ast::get_node_type_name
11961  */
11962  AstNodeType get_node_type() const noexcept override {
11964  }
11965 
11966  /**
11967  * \brief Return type (ast::AstNodeType) of ast node as std::string
11968  *
11969  * Every node in the ast has a type defined in ast::AstNodeType.
11970  * This type name can be returned as a std::string for printing
11971  * node to text/json form.
11972  *
11973  * \return name of the node type as a string i.e. "FunctionBlock"
11974  *
11975  * \sa Ast::get_node_name
11976  */
11977  std::string get_node_type_name() const noexcept override {
11978  return "FunctionBlock";
11979  }
11980 
11981  /**
11982  * \brief Return NMODL statement of ast node as std::string
11983  *
11984  * Every node is related to a special statement in the NMODL. This
11985  * statement can be returned as a std::string for printing to
11986  * text/json form.
11987  *
11988  * \return name of the statement as a string i.e. "FUNCTION "
11989  *
11990  * \sa Ast::get_nmodl_name
11991  */
11992  std::string get_nmodl_name() const noexcept override {
11993  return "FUNCTION ";
11994  }
11995 
11996  /**
11997  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11998  */
11999  std::shared_ptr<Ast> get_shared_ptr() override {
12000  return std::static_pointer_cast<FunctionBlock>(shared_from_this());
12001  }
12002 
12003  /**
12004  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12005  */
12006  std::shared_ptr<const Ast> get_shared_ptr() const override {
12007  return std::static_pointer_cast<const FunctionBlock>(shared_from_this());
12008  }
12009 
12010  /**
12011  * \brief Return associated token for the current ast node
12012  *
12013  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
12014  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
12015  * nullptr to store in the nmodl::symtab::SymbolTable.
12016  *
12017  * \return pointer to token if exist otherwise nullptr
12018  */
12019  const ModToken* get_token() const noexcept override {
12020  return token.get();
12021  }
12022 
12023  /**
12024  * \brief Return associated symbol table for the current ast node
12025  *
12026  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12027  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12028  * and it can be accessed using this method.
12029  *
12030  * \return pointer to the symbol table
12031  *
12032  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12033  */
12035  return symtab;
12036  }
12037 
12038 
12039 
12040 
12041 
12042 
12043 /**
12044  * \brief Return name of the node
12045  *
12046  * Some ast nodes have a member marked designated as node name. For example,
12047  * in case of this ast::Name has name designated as a
12048  * node name.
12049  *
12050  * @return name of the node as std::string
12051  *
12052  * \sa Ast::get_node_type_name
12053  */
12054 std::string get_node_name() const override;
12055 
12056 
12057  /**
12058  * \brief Getter for member variable \ref FunctionBlock.name
12059  */
12060  const std::shared_ptr<Name>& get_name() const noexcept {
12061  return name;
12062  }
12063 
12064 
12065 
12066 
12067 
12068 
12069 
12070  /**
12071  * \brief Getter for member variable \ref FunctionBlock.parameters
12072  */
12073  const ArgumentVector& get_parameters() const noexcept override {
12074  return parameters;
12075  }
12076 
12077 
12078 
12079 
12080 
12081 
12082 
12083  /**
12084  * \brief Getter for member variable \ref FunctionBlock.unit
12085  */
12086  const std::shared_ptr<Unit>& get_unit() const noexcept {
12087  return unit;
12088  }
12089 
12090 
12091 
12092 
12093 
12094 
12095 
12096  /**
12097  * \brief Getter for member variable \ref FunctionBlock.statement_block
12098  */
12099  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
12100  return statement_block;
12101  }
12102 
12103 
12104 
12105  /// \}
12106 
12107  /// \name Setters
12108  /// \{
12109 
12110 
12111  /**
12112  * \brief Set token for the current ast node
12113  */
12114  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
12115 
12116  /**
12117  * \brief Set symbol table for the current ast node
12118  *
12119  * Top level, block scoped nodes store symbol table in the ast node.
12120  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12121  * for every node in the ast.
12122  *
12123  * \sa nmodl::visitor::SymtabVisitor
12124  */
12125  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
12126  symtab = newsymtab;
12127  }
12128 
12129 
12130 
12131  /**
12132  * \brief Setter for member variable \ref FunctionBlock.name (rvalue reference)
12133  */
12134  void set_name(std::shared_ptr<Name>&& name);
12135 
12136  /**
12137  * \brief Setter for member variable \ref FunctionBlock.name
12138  */
12139  void set_name(const std::shared_ptr<Name>& name);
12140 
12141 
12142  /**
12143  * \brief Setter for member variable \ref FunctionBlock.parameters (rvalue reference)
12144  */
12145  void set_parameters(ArgumentVector&& parameters);
12146 
12147  /**
12148  * \brief Setter for member variable \ref FunctionBlock.parameters
12149  */
12150  void set_parameters(const ArgumentVector& parameters);
12151 
12152 
12153  /**
12154  * \brief Setter for member variable \ref FunctionBlock.unit (rvalue reference)
12155  */
12156  void set_unit(std::shared_ptr<Unit>&& unit);
12157 
12158  /**
12159  * \brief Setter for member variable \ref FunctionBlock.unit
12160  */
12161  void set_unit(const std::shared_ptr<Unit>& unit);
12162 
12163 
12164  /**
12165  * \brief Setter for member variable \ref FunctionBlock.statement_block (rvalue reference)
12166  */
12167  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
12168 
12169  /**
12170  * \brief Setter for member variable \ref FunctionBlock.statement_block
12171  */
12172  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
12173 
12174 
12175  /// \}
12176 
12177  /// \name Visitor
12178  /// \{
12179 
12180  /**
12181  * \brief visit children i.e. member variables of current node using provided visitor
12182  *
12183  * Different nodes in the AST have different members (i.e. children). This method
12184  * recursively visits children using provided visitor.
12185  *
12186  * \param v Concrete visitor that will be used to recursively visit children
12187  *
12188  * \sa Ast::visit_children for example.
12189  */
12190  void visit_children(visitor::Visitor& v) override;
12191 
12192  /**
12193  * \brief visit children i.e. member variables of current node using provided visitor
12194  *
12195  * Different nodes in the AST have different members (i.e. children). This method
12196  * recursively visits children using provided visitor.
12197  *
12198  * \param v Concrete constant visitor that will be used to recursively visit children
12199  *
12200  * \sa Ast::visit_children for example.
12201  */
12202  void visit_children(visitor::ConstVisitor& v) const override;
12203 
12204  /**
12205  * \brief accept (or visit) the current AST node using provided visitor
12206  *
12207  * Instead of visiting children of AST node, like Ast::visit_children,
12208  * accept allows to visit the current node itself using provided concrete
12209  * visitor.
12210  *
12211  * \param v Concrete visitor that will be used to recursively visit node
12212  *
12213  * \sa Ast::accept for example.
12214  */
12215  void accept(visitor::Visitor& v) override;
12216 
12217  /**
12218  * \copydoc accept(visitor::Visitor&)
12219  */
12220  void accept(visitor::ConstVisitor& v) const override;
12221 
12222  /// \}
12223 
12224 
12225 
12226  private:
12227  /**
12228  * \brief Set this object as parent for all the children
12229  *
12230  * This should be called in every object (with children) constructor
12231  * to set parents. Since it is called only in the constructors it
12232  * should not be virtual to avoid ambiguities (issue #295).
12233  */
12234  void set_parent_in_children();
12235 };
12236 
12237 /** @} */ // end of ast_class
12238 
12239 
12240 } // namespace ast
12241 } // namespace nmodl
12242 #endif // !NMODL_AST_FUNCTION_BLOCK_HPP
12243 #ifndef NMODL_AST_PROCEDURE_BLOCK_HPP
12244 #define NMODL_AST_PROCEDURE_BLOCK_HPP
12245 
12246 
12247 namespace nmodl {
12248 namespace ast {
12249 
12250 /**
12251  * @addtogroup ast_class
12252  * @ingroup ast
12253  * @{
12254  */
12255 
12256 /**
12257  * \brief TODO
12258  *
12259  *
12260 */
12261 class ProcedureBlock : public Block {
12262  private:
12263  /// Name of the procedure
12264  std::shared_ptr<Name> name;
12265  /// Vector of the parameters
12267  /// Unit if specified
12268  std::shared_ptr<Unit> unit;
12269  /// Block with statements vector
12270  std::shared_ptr<StatementBlock> statement_block;
12271  /// token with location information
12272  std::shared_ptr<ModToken> token;
12273  /// symbol table for a block
12274  symtab::SymbolTable* symtab = nullptr;
12275 
12276  public:
12277 
12278  /// \name Ctor & dtor
12279  /// \{
12280 
12281  explicit ProcedureBlock(Name* name, ArgumentVector parameters, Unit* unit, StatementBlock* statement_block);
12282  explicit ProcedureBlock(const std::shared_ptr<Name>& name, const ArgumentVector& parameters, const std::shared_ptr<Unit>& unit, const std::shared_ptr<StatementBlock>& statement_block);
12283  ProcedureBlock(const ProcedureBlock& obj);
12284 
12285 
12286  virtual ~ProcedureBlock() = default;
12287 
12288  /// \}
12289 
12290 
12291 
12292 
12293 
12294 
12295  /**
12296  * \brief Check if the ast node is an instance of ast::ProcedureBlock
12297  * \return true as object is of type ast::ProcedureBlock
12298  */
12299  bool is_procedure_block () const noexcept override {
12300  return true;
12301  }
12302 
12303  /**
12304  * \brief Return a copy of the current node
12305  *
12306  * Recursively make a new copy/clone of the current node including
12307  * all members and return a pointer to the node. This is used for
12308  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12309  * ast.
12310  *
12311  * @return pointer to the clone/copy of the current node
12312  */
12313  ProcedureBlock* clone() const override {
12314  return new ProcedureBlock(*this);
12315  }
12316 
12317  /// \name Getters
12318  /// \{
12319 
12320  /**
12321  * \brief Return type (ast::AstNodeType) of ast node
12322  *
12323  * Every node in the ast has a type defined in ast::AstNodeType and this
12324  * function is used to retrieve the same.
12325  *
12326  * \return ast node type i.e. ast::AstNodeType::PROCEDURE_BLOCK
12327  *
12328  * \sa Ast::get_node_type_name
12329  */
12330  AstNodeType get_node_type() const noexcept override {
12332  }
12333 
12334  /**
12335  * \brief Return type (ast::AstNodeType) of ast node as std::string
12336  *
12337  * Every node in the ast has a type defined in ast::AstNodeType.
12338  * This type name can be returned as a std::string for printing
12339  * node to text/json form.
12340  *
12341  * \return name of the node type as a string i.e. "ProcedureBlock"
12342  *
12343  * \sa Ast::get_node_name
12344  */
12345  std::string get_node_type_name() const noexcept override {
12346  return "ProcedureBlock";
12347  }
12348 
12349  /**
12350  * \brief Return NMODL statement of ast node as std::string
12351  *
12352  * Every node is related to a special statement in the NMODL. This
12353  * statement can be returned as a std::string for printing to
12354  * text/json form.
12355  *
12356  * \return name of the statement as a string i.e. "PROCEDURE "
12357  *
12358  * \sa Ast::get_nmodl_name
12359  */
12360  std::string get_nmodl_name() const noexcept override {
12361  return "PROCEDURE ";
12362  }
12363 
12364  /**
12365  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12366  */
12367  std::shared_ptr<Ast> get_shared_ptr() override {
12368  return std::static_pointer_cast<ProcedureBlock>(shared_from_this());
12369  }
12370 
12371  /**
12372  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12373  */
12374  std::shared_ptr<const Ast> get_shared_ptr() const override {
12375  return std::static_pointer_cast<const ProcedureBlock>(shared_from_this());
12376  }
12377 
12378  /**
12379  * \brief Return associated token for the current ast node
12380  *
12381  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
12382  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
12383  * nullptr to store in the nmodl::symtab::SymbolTable.
12384  *
12385  * \return pointer to token if exist otherwise nullptr
12386  */
12387  const ModToken* get_token() const noexcept override {
12388  return token.get();
12389  }
12390 
12391  /**
12392  * \brief Return associated symbol table for the current ast node
12393  *
12394  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12395  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12396  * and it can be accessed using this method.
12397  *
12398  * \return pointer to the symbol table
12399  *
12400  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12401  */
12403  return symtab;
12404  }
12405 
12406 
12407 
12408 
12409 
12410 
12411 /**
12412  * \brief Return name of the node
12413  *
12414  * Some ast nodes have a member marked designated as node name. For example,
12415  * in case of this ast::Name has name designated as a
12416  * node name.
12417  *
12418  * @return name of the node as std::string
12419  *
12420  * \sa Ast::get_node_type_name
12421  */
12422 std::string get_node_name() const override;
12423 
12424 
12425  /**
12426  * \brief Getter for member variable \ref ProcedureBlock.name
12427  */
12428  const std::shared_ptr<Name>& get_name() const noexcept {
12429  return name;
12430  }
12431 
12432 
12433 
12434 
12435 
12436 
12437 
12438  /**
12439  * \brief Getter for member variable \ref ProcedureBlock.parameters
12440  */
12441  const ArgumentVector& get_parameters() const noexcept override {
12442  return parameters;
12443  }
12444 
12445 
12446 
12447 
12448 
12449 
12450 
12451  /**
12452  * \brief Getter for member variable \ref ProcedureBlock.unit
12453  */
12454  const std::shared_ptr<Unit>& get_unit() const noexcept {
12455  return unit;
12456  }
12457 
12458 
12459 
12460 
12461 
12462 
12463 
12464  /**
12465  * \brief Getter for member variable \ref ProcedureBlock.statement_block
12466  */
12467  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
12468  return statement_block;
12469  }
12470 
12471 
12472 
12473  /// \}
12474 
12475  /// \name Setters
12476  /// \{
12477 
12478 
12479  /**
12480  * \brief Set token for the current ast node
12481  */
12482  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
12483 
12484  /**
12485  * \brief Set symbol table for the current ast node
12486  *
12487  * Top level, block scoped nodes store symbol table in the ast node.
12488  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12489  * for every node in the ast.
12490  *
12491  * \sa nmodl::visitor::SymtabVisitor
12492  */
12493  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
12494  symtab = newsymtab;
12495  }
12496 
12497 
12498 
12499  /**
12500  * \brief Setter for member variable \ref ProcedureBlock.name (rvalue reference)
12501  */
12502  void set_name(std::shared_ptr<Name>&& name);
12503 
12504  /**
12505  * \brief Setter for member variable \ref ProcedureBlock.name
12506  */
12507  void set_name(const std::shared_ptr<Name>& name);
12508 
12509 
12510  /**
12511  * \brief Setter for member variable \ref ProcedureBlock.parameters (rvalue reference)
12512  */
12513  void set_parameters(ArgumentVector&& parameters);
12514 
12515  /**
12516  * \brief Setter for member variable \ref ProcedureBlock.parameters
12517  */
12518  void set_parameters(const ArgumentVector& parameters);
12519 
12520 
12521  /**
12522  * \brief Setter for member variable \ref ProcedureBlock.unit (rvalue reference)
12523  */
12524  void set_unit(std::shared_ptr<Unit>&& unit);
12525 
12526  /**
12527  * \brief Setter for member variable \ref ProcedureBlock.unit
12528  */
12529  void set_unit(const std::shared_ptr<Unit>& unit);
12530 
12531 
12532  /**
12533  * \brief Setter for member variable \ref ProcedureBlock.statement_block (rvalue reference)
12534  */
12535  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
12536 
12537  /**
12538  * \brief Setter for member variable \ref ProcedureBlock.statement_block
12539  */
12540  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
12541 
12542 
12543  /// \}
12544 
12545  /// \name Visitor
12546  /// \{
12547 
12548  /**
12549  * \brief visit children i.e. member variables of current node using provided visitor
12550  *
12551  * Different nodes in the AST have different members (i.e. children). This method
12552  * recursively visits children using provided visitor.
12553  *
12554  * \param v Concrete visitor that will be used to recursively visit children
12555  *
12556  * \sa Ast::visit_children for example.
12557  */
12558  void visit_children(visitor::Visitor& v) override;
12559 
12560  /**
12561  * \brief visit children i.e. member variables of current node using provided visitor
12562  *
12563  * Different nodes in the AST have different members (i.e. children). This method
12564  * recursively visits children using provided visitor.
12565  *
12566  * \param v Concrete constant visitor that will be used to recursively visit children
12567  *
12568  * \sa Ast::visit_children for example.
12569  */
12570  void visit_children(visitor::ConstVisitor& v) const override;
12571 
12572  /**
12573  * \brief accept (or visit) the current AST node using provided visitor
12574  *
12575  * Instead of visiting children of AST node, like Ast::visit_children,
12576  * accept allows to visit the current node itself using provided concrete
12577  * visitor.
12578  *
12579  * \param v Concrete visitor that will be used to recursively visit node
12580  *
12581  * \sa Ast::accept for example.
12582  */
12583  void accept(visitor::Visitor& v) override;
12584 
12585  /**
12586  * \copydoc accept(visitor::Visitor&)
12587  */
12588  void accept(visitor::ConstVisitor& v) const override;
12589 
12590  /// \}
12591 
12592 
12593 
12594  private:
12595  /**
12596  * \brief Set this object as parent for all the children
12597  *
12598  * This should be called in every object (with children) constructor
12599  * to set parents. Since it is called only in the constructors it
12600  * should not be virtual to avoid ambiguities (issue #295).
12601  */
12602  void set_parent_in_children();
12603 };
12604 
12605 /** @} */ // end of ast_class
12606 
12607 
12608 } // namespace ast
12609 } // namespace nmodl
12610 #endif // !NMODL_AST_PROCEDURE_BLOCK_HPP
12611 #ifndef NMODL_AST_NET_RECEIVE_BLOCK_HPP
12612 #define NMODL_AST_NET_RECEIVE_BLOCK_HPP
12613 
12614 
12615 namespace nmodl {
12616 namespace ast {
12617 
12618 /**
12619  * @addtogroup ast_class
12620  * @ingroup ast
12621  * @{
12622  */
12623 
12624 /**
12625  * \brief TODO
12626  *
12627  *
12628 */
12629 class NetReceiveBlock : public Block {
12630  private:
12631  /// Parameters to the net receive block
12633  /// Block with statements vector
12634  std::shared_ptr<StatementBlock> statement_block;
12635  /// token with location information
12636  std::shared_ptr<ModToken> token;
12637  /// symbol table for a block
12638  symtab::SymbolTable* symtab = nullptr;
12639 
12640  public:
12641 
12642  /// \name Ctor & dtor
12643  /// \{
12644 
12645  explicit NetReceiveBlock(ArgumentVector parameters, StatementBlock* statement_block);
12646  explicit NetReceiveBlock(const ArgumentVector& parameters, const std::shared_ptr<StatementBlock>& statement_block);
12647  NetReceiveBlock(const NetReceiveBlock& obj);
12648 
12649 
12650  virtual ~NetReceiveBlock() = default;
12651 
12652  /// \}
12653 
12654 
12655 
12656 
12657 
12658 
12659  /**
12660  * \brief Check if the ast node is an instance of ast::NetReceiveBlock
12661  * \return true as object is of type ast::NetReceiveBlock
12662  */
12663  bool is_net_receive_block () const noexcept override {
12664  return true;
12665  }
12666 
12667  /**
12668  * \brief Return a copy of the current node
12669  *
12670  * Recursively make a new copy/clone of the current node including
12671  * all members and return a pointer to the node. This is used for
12672  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12673  * ast.
12674  *
12675  * @return pointer to the clone/copy of the current node
12676  */
12677  NetReceiveBlock* clone() const override {
12678  return new NetReceiveBlock(*this);
12679  }
12680 
12681  /// \name Getters
12682  /// \{
12683 
12684  /**
12685  * \brief Return type (ast::AstNodeType) of ast node
12686  *
12687  * Every node in the ast has a type defined in ast::AstNodeType and this
12688  * function is used to retrieve the same.
12689  *
12690  * \return ast node type i.e. ast::AstNodeType::NET_RECEIVE_BLOCK
12691  *
12692  * \sa Ast::get_node_type_name
12693  */
12694  AstNodeType get_node_type() const noexcept override {
12696  }
12697 
12698  /**
12699  * \brief Return type (ast::AstNodeType) of ast node as std::string
12700  *
12701  * Every node in the ast has a type defined in ast::AstNodeType.
12702  * This type name can be returned as a std::string for printing
12703  * node to text/json form.
12704  *
12705  * \return name of the node type as a string i.e. "NetReceiveBlock"
12706  *
12707  * \sa Ast::get_node_name
12708  */
12709  std::string get_node_type_name() const noexcept override {
12710  return "NetReceiveBlock";
12711  }
12712 
12713  /**
12714  * \brief Return NMODL statement of ast node as std::string
12715  *
12716  * Every node is related to a special statement in the NMODL. This
12717  * statement can be returned as a std::string for printing to
12718  * text/json form.
12719  *
12720  * \return name of the statement as a string i.e. "NET_RECEIVE "
12721  *
12722  * \sa Ast::get_nmodl_name
12723  */
12724  std::string get_nmodl_name() const noexcept override {
12725  return "NET_RECEIVE ";
12726  }
12727 
12728  /**
12729  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12730  */
12731  std::shared_ptr<Ast> get_shared_ptr() override {
12732  return std::static_pointer_cast<NetReceiveBlock>(shared_from_this());
12733  }
12734 
12735  /**
12736  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12737  */
12738  std::shared_ptr<const Ast> get_shared_ptr() const override {
12739  return std::static_pointer_cast<const NetReceiveBlock>(shared_from_this());
12740  }
12741 
12742  /**
12743  * \brief Return associated token for the current ast node
12744  *
12745  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
12746  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
12747  * nullptr to store in the nmodl::symtab::SymbolTable.
12748  *
12749  * \return pointer to token if exist otherwise nullptr
12750  */
12751  const ModToken* get_token() const noexcept override {
12752  return token.get();
12753  }
12754 
12755  /**
12756  * \brief Return associated symbol table for the current ast node
12757  *
12758  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12759  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12760  * and it can be accessed using this method.
12761  *
12762  * \return pointer to the symbol table
12763  *
12764  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12765  */
12767  return symtab;
12768  }
12769 
12770 
12771 
12772 
12773 
12774 
12775 
12776 
12777  /**
12778  * \brief Getter for member variable \ref NetReceiveBlock.parameters
12779  */
12780  const ArgumentVector& get_parameters() const noexcept override {
12781  return parameters;
12782  }
12783 
12784 
12785 
12786 
12787 
12788 
12789 
12790  /**
12791  * \brief Getter for member variable \ref NetReceiveBlock.statement_block
12792  */
12793  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
12794  return statement_block;
12795  }
12796 
12797 
12798 
12799  /// \}
12800 
12801  /// \name Setters
12802  /// \{
12803 
12804 
12805  /**
12806  * \brief Set token for the current ast node
12807  */
12808  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
12809 
12810  /**
12811  * \brief Set symbol table for the current ast node
12812  *
12813  * Top level, block scoped nodes store symbol table in the ast node.
12814  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12815  * for every node in the ast.
12816  *
12817  * \sa nmodl::visitor::SymtabVisitor
12818  */
12819  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
12820  symtab = newsymtab;
12821  }
12822 
12823 
12824 
12825  /**
12826  * \brief Setter for member variable \ref NetReceiveBlock.parameters (rvalue reference)
12827  */
12828  void set_parameters(ArgumentVector&& parameters);
12829 
12830  /**
12831  * \brief Setter for member variable \ref NetReceiveBlock.parameters
12832  */
12833  void set_parameters(const ArgumentVector& parameters);
12834 
12835 
12836  /**
12837  * \brief Setter for member variable \ref NetReceiveBlock.statement_block (rvalue reference)
12838  */
12839  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
12840 
12841  /**
12842  * \brief Setter for member variable \ref NetReceiveBlock.statement_block
12843  */
12844  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
12845 
12846 
12847  /// \}
12848 
12849  /// \name Visitor
12850  /// \{
12851 
12852  /**
12853  * \brief visit children i.e. member variables of current node using provided visitor
12854  *
12855  * Different nodes in the AST have different members (i.e. children). This method
12856  * recursively visits children using provided visitor.
12857  *
12858  * \param v Concrete visitor that will be used to recursively visit children
12859  *
12860  * \sa Ast::visit_children for example.
12861  */
12862  void visit_children(visitor::Visitor& v) override;
12863 
12864  /**
12865  * \brief visit children i.e. member variables of current node using provided visitor
12866  *
12867  * Different nodes in the AST have different members (i.e. children). This method
12868  * recursively visits children using provided visitor.
12869  *
12870  * \param v Concrete constant visitor that will be used to recursively visit children
12871  *
12872  * \sa Ast::visit_children for example.
12873  */
12874  void visit_children(visitor::ConstVisitor& v) const override;
12875 
12876  /**
12877  * \brief accept (or visit) the current AST node using provided visitor
12878  *
12879  * Instead of visiting children of AST node, like Ast::visit_children,
12880  * accept allows to visit the current node itself using provided concrete
12881  * visitor.
12882  *
12883  * \param v Concrete visitor that will be used to recursively visit node
12884  *
12885  * \sa Ast::accept for example.
12886  */
12887  void accept(visitor::Visitor& v) override;
12888 
12889  /**
12890  * \copydoc accept(visitor::Visitor&)
12891  */
12892  void accept(visitor::ConstVisitor& v) const override;
12893 
12894  /// \}
12895 
12896 
12897 
12898  private:
12899  /**
12900  * \brief Set this object as parent for all the children
12901  *
12902  * This should be called in every object (with children) constructor
12903  * to set parents. Since it is called only in the constructors it
12904  * should not be virtual to avoid ambiguities (issue #295).
12905  */
12906  void set_parent_in_children();
12907 };
12908 
12909 /** @} */ // end of ast_class
12910 
12911 
12912 } // namespace ast
12913 } // namespace nmodl
12914 #endif // !NMODL_AST_NET_RECEIVE_BLOCK_HPP
12915 #ifndef NMODL_AST_SOLVE_BLOCK_HPP
12916 #define NMODL_AST_SOLVE_BLOCK_HPP
12917 
12918 
12919 namespace nmodl {
12920 namespace ast {
12921 
12922 /**
12923  * @addtogroup ast_class
12924  * @ingroup ast
12925  * @{
12926  */
12927 
12928 /**
12929  * \brief TODO
12930  *
12931  *
12932 */
12933 class SolveBlock : public Block {
12934  private:
12935  /// Name of the block to solve
12936  std::shared_ptr<Name> block_name;
12937  /// Name of the integration method
12938  std::shared_ptr<Name> method;
12939  /// Name of the integration method
12940  std::shared_ptr<Name> steadystate;
12941  /// Block to be executed on error
12942  std::shared_ptr<StatementBlock> ifsolerr;
12943  /// token with location information
12944  std::shared_ptr<ModToken> token;
12945  /// symbol table for a block
12946  symtab::SymbolTable* symtab = nullptr;
12947 
12948  public:
12949 
12950  /// \name Ctor & dtor
12951  /// \{
12952 
12953  explicit SolveBlock(Name* block_name, Name* method, Name* steadystate, StatementBlock* ifsolerr);
12954  explicit SolveBlock(const std::shared_ptr<Name>& block_name, const std::shared_ptr<Name>& method, const std::shared_ptr<Name>& steadystate, const std::shared_ptr<StatementBlock>& ifsolerr);
12955  SolveBlock(const SolveBlock& obj);
12956 
12957 
12958  virtual ~SolveBlock() = default;
12959 
12960  /// \}
12961 
12962 
12963 
12964 
12965 
12966 
12967  /**
12968  * \brief Check if the ast node is an instance of ast::SolveBlock
12969  * \return true as object is of type ast::SolveBlock
12970  */
12971  bool is_solve_block () const noexcept override {
12972  return true;
12973  }
12974 
12975  /**
12976  * \brief Return a copy of the current node
12977  *
12978  * Recursively make a new copy/clone of the current node including
12979  * all members and return a pointer to the node. This is used for
12980  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12981  * ast.
12982  *
12983  * @return pointer to the clone/copy of the current node
12984  */
12985  SolveBlock* clone() const override {
12986  return new SolveBlock(*this);
12987  }
12988 
12989  /// \name Getters
12990  /// \{
12991 
12992  /**
12993  * \brief Return type (ast::AstNodeType) of ast node
12994  *
12995  * Every node in the ast has a type defined in ast::AstNodeType and this
12996  * function is used to retrieve the same.
12997  *
12998  * \return ast node type i.e. ast::AstNodeType::SOLVE_BLOCK
12999  *
13000  * \sa Ast::get_node_type_name
13001  */
13002  AstNodeType get_node_type() const noexcept override {
13003  return AstNodeType::SOLVE_BLOCK;
13004  }
13005 
13006  /**
13007  * \brief Return type (ast::AstNodeType) of ast node as std::string
13008  *
13009  * Every node in the ast has a type defined in ast::AstNodeType.
13010  * This type name can be returned as a std::string for printing
13011  * node to text/json form.
13012  *
13013  * \return name of the node type as a string i.e. "SolveBlock"
13014  *
13015  * \sa Ast::get_node_name
13016  */
13017  std::string get_node_type_name() const noexcept override {
13018  return "SolveBlock";
13019  }
13020 
13021  /**
13022  * \brief Return NMODL statement of ast node as std::string
13023  *
13024  * Every node is related to a special statement in the NMODL. This
13025  * statement can be returned as a std::string for printing to
13026  * text/json form.
13027  *
13028  * \return name of the statement as a string i.e. "SOLVE"
13029  *
13030  * \sa Ast::get_nmodl_name
13031  */
13032  std::string get_nmodl_name() const noexcept override {
13033  return "SOLVE";
13034  }
13035 
13036  /**
13037  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13038  */
13039  std::shared_ptr<Ast> get_shared_ptr() override {
13040  return std::static_pointer_cast<SolveBlock>(shared_from_this());
13041  }
13042 
13043  /**
13044  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13045  */
13046  std::shared_ptr<const Ast> get_shared_ptr() const override {
13047  return std::static_pointer_cast<const SolveBlock>(shared_from_this());
13048  }
13049 
13050  /**
13051  * \brief Return associated token for the current ast node
13052  *
13053  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
13054  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
13055  * nullptr to store in the nmodl::symtab::SymbolTable.
13056  *
13057  * \return pointer to token if exist otherwise nullptr
13058  */
13059  const ModToken* get_token() const noexcept override {
13060  return token.get();
13061  }
13062 
13063  /**
13064  * \brief Return associated symbol table for the current ast node
13065  *
13066  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13067  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13068  * and it can be accessed using this method.
13069  *
13070  * \return pointer to the symbol table
13071  *
13072  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13073  */
13075  return symtab;
13076  }
13077 
13078 
13079 
13080 
13081 
13082 
13083 
13084 
13085  /**
13086  * \brief Getter for member variable \ref SolveBlock.block_name
13087  */
13088  const std::shared_ptr<Name>& get_block_name() const noexcept {
13089  return block_name;
13090  }
13091 
13092 
13093 
13094 
13095 
13096 
13097 
13098  /**
13099  * \brief Getter for member variable \ref SolveBlock.method
13100  */
13101  const std::shared_ptr<Name>& get_method() const noexcept {
13102  return method;
13103  }
13104 
13105 
13106 
13107 
13108 
13109 
13110 
13111  /**
13112  * \brief Getter for member variable \ref SolveBlock.steadystate
13113  */
13114  const std::shared_ptr<Name>& get_steadystate() const noexcept {
13115  return steadystate;
13116  }
13117 
13118 
13119 
13120 
13121 
13122 
13123 
13124  /**
13125  * \brief Getter for member variable \ref SolveBlock.ifsolerr
13126  */
13127  const std::shared_ptr<StatementBlock>& get_ifsolerr() const noexcept {
13128  return ifsolerr;
13129  }
13130 
13131 
13132 
13133  /// \}
13134 
13135  /// \name Setters
13136  /// \{
13137 
13138 
13139  /**
13140  * \brief Set token for the current ast node
13141  */
13142  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
13143 
13144  /**
13145  * \brief Set symbol table for the current ast node
13146  *
13147  * Top level, block scoped nodes store symbol table in the ast node.
13148  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13149  * for every node in the ast.
13150  *
13151  * \sa nmodl::visitor::SymtabVisitor
13152  */
13153  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
13154  symtab = newsymtab;
13155  }
13156 
13157 
13158 
13159  /**
13160  * \brief Setter for member variable \ref SolveBlock.block_name (rvalue reference)
13161  */
13162  void set_block_name(std::shared_ptr<Name>&& block_name);
13163 
13164  /**
13165  * \brief Setter for member variable \ref SolveBlock.block_name
13166  */
13167  void set_block_name(const std::shared_ptr<Name>& block_name);
13168 
13169 
13170  /**
13171  * \brief Setter for member variable \ref SolveBlock.method (rvalue reference)
13172  */
13173  void set_method(std::shared_ptr<Name>&& method);
13174 
13175  /**
13176  * \brief Setter for member variable \ref SolveBlock.method
13177  */
13178  void set_method(const std::shared_ptr<Name>& method);
13179 
13180 
13181  /**
13182  * \brief Setter for member variable \ref SolveBlock.steadystate (rvalue reference)
13183  */
13184  void set_steadystate(std::shared_ptr<Name>&& steadystate);
13185 
13186  /**
13187  * \brief Setter for member variable \ref SolveBlock.steadystate
13188  */
13189  void set_steadystate(const std::shared_ptr<Name>& steadystate);
13190 
13191 
13192  /**
13193  * \brief Setter for member variable \ref SolveBlock.ifsolerr (rvalue reference)
13194  */
13195  void set_ifsolerr(std::shared_ptr<StatementBlock>&& ifsolerr);
13196 
13197  /**
13198  * \brief Setter for member variable \ref SolveBlock.ifsolerr
13199  */
13200  void set_ifsolerr(const std::shared_ptr<StatementBlock>& ifsolerr);
13201 
13202 
13203  /// \}
13204 
13205  /// \name Visitor
13206  /// \{
13207 
13208  /**
13209  * \brief visit children i.e. member variables of current node using provided visitor
13210  *
13211  * Different nodes in the AST have different members (i.e. children). This method
13212  * recursively visits children using provided visitor.
13213  *
13214  * \param v Concrete visitor that will be used to recursively visit children
13215  *
13216  * \sa Ast::visit_children for example.
13217  */
13218  void visit_children(visitor::Visitor& v) override;
13219 
13220  /**
13221  * \brief visit children i.e. member variables of current node using provided visitor
13222  *
13223  * Different nodes in the AST have different members (i.e. children). This method
13224  * recursively visits children using provided visitor.
13225  *
13226  * \param v Concrete constant visitor that will be used to recursively visit children
13227  *
13228  * \sa Ast::visit_children for example.
13229  */
13230  void visit_children(visitor::ConstVisitor& v) const override;
13231 
13232  /**
13233  * \brief accept (or visit) the current AST node using provided visitor
13234  *
13235  * Instead of visiting children of AST node, like Ast::visit_children,
13236  * accept allows to visit the current node itself using provided concrete
13237  * visitor.
13238  *
13239  * \param v Concrete visitor that will be used to recursively visit node
13240  *
13241  * \sa Ast::accept for example.
13242  */
13243  void accept(visitor::Visitor& v) override;
13244 
13245  /**
13246  * \copydoc accept(visitor::Visitor&)
13247  */
13248  void accept(visitor::ConstVisitor& v) const override;
13249 
13250  /// \}
13251 
13252 
13253 
13254  private:
13255  /**
13256  * \brief Set this object as parent for all the children
13257  *
13258  * This should be called in every object (with children) constructor
13259  * to set parents. Since it is called only in the constructors it
13260  * should not be virtual to avoid ambiguities (issue #295).
13261  */
13262  void set_parent_in_children();
13263 };
13264 
13265 /** @} */ // end of ast_class
13266 
13267 
13268 } // namespace ast
13269 } // namespace nmodl
13270 #endif // !NMODL_AST_SOLVE_BLOCK_HPP
13271 #ifndef NMODL_AST_BREAKPOINT_BLOCK_HPP
13272 #define NMODL_AST_BREAKPOINT_BLOCK_HPP
13273 
13274 
13275 namespace nmodl {
13276 namespace ast {
13277 
13278 /**
13279  * @addtogroup ast_class
13280  * @ingroup ast
13281  * @{
13282  */
13283 
13284 /**
13285  * \brief Represents a `BREAKPOINT` block in NMODL
13286  *
13287  * The `BREAKPOINT` block is used to update current and conductance.
13288  * at each time step. Here is an example of `BEFORE` :
13289  *
13290  * \code{.mod}
13291  * BREAKPOINT {
13292  * SOLVE states METHOD cnexp
13293  * gna = gnabar*m*m*m*h
13294  * ina = gna*(v - ena)
13295  * gk = gkbar*n*n*n*n
13296  * ik = gk*(v - ek)
13297  * il = gl*(v - el)
13298  * }
13299  * \endcode
13300  *
13301  * \sa ast::DerivativeBlock ast::InitialBlock
13302  *
13303 */
13304 class BreakpointBlock : public Block {
13305  private:
13306  /// Block with statements vector
13307  std::shared_ptr<StatementBlock> statement_block;
13308  /// token with location information
13309  std::shared_ptr<ModToken> token;
13310  /// symbol table for a block
13311  symtab::SymbolTable* symtab = nullptr;
13312 
13313  public:
13314 
13315  /// \name Ctor & dtor
13316  /// \{
13317 
13318  explicit BreakpointBlock(StatementBlock* statement_block);
13319  explicit BreakpointBlock(const std::shared_ptr<StatementBlock>& statement_block);
13320  BreakpointBlock(const BreakpointBlock& obj);
13321 
13322 
13323  virtual ~BreakpointBlock() = default;
13324 
13325  /// \}
13326 
13327 
13328 
13329 
13330 
13331 
13332  /**
13333  * \brief Check if the ast node is an instance of ast::BreakpointBlock
13334  * \return true as object is of type ast::BreakpointBlock
13335  */
13336  bool is_breakpoint_block () const noexcept override {
13337  return true;
13338  }
13339 
13340  /**
13341  * \brief Return a copy of the current node
13342  *
13343  * Recursively make a new copy/clone of the current node including
13344  * all members and return a pointer to the node. This is used for
13345  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13346  * ast.
13347  *
13348  * @return pointer to the clone/copy of the current node
13349  */
13350  BreakpointBlock* clone() const override {
13351  return new BreakpointBlock(*this);
13352  }
13353 
13354  /// \name Getters
13355  /// \{
13356 
13357  /**
13358  * \brief Return type (ast::AstNodeType) of ast node
13359  *
13360  * Every node in the ast has a type defined in ast::AstNodeType and this
13361  * function is used to retrieve the same.
13362  *
13363  * \return ast node type i.e. ast::AstNodeType::BREAKPOINT_BLOCK
13364  *
13365  * \sa Ast::get_node_type_name
13366  */
13367  AstNodeType get_node_type() const noexcept override {
13369  }
13370 
13371  /**
13372  * \brief Return type (ast::AstNodeType) of ast node as std::string
13373  *
13374  * Every node in the ast has a type defined in ast::AstNodeType.
13375  * This type name can be returned as a std::string for printing
13376  * node to text/json form.
13377  *
13378  * \return name of the node type as a string i.e. "BreakpointBlock"
13379  *
13380  * \sa Ast::get_node_name
13381  */
13382  std::string get_node_type_name() const noexcept override {
13383  return "BreakpointBlock";
13384  }
13385 
13386  /**
13387  * \brief Return NMODL statement of ast node as std::string
13388  *
13389  * Every node is related to a special statement in the NMODL. This
13390  * statement can be returned as a std::string for printing to
13391  * text/json form.
13392  *
13393  * \return name of the statement as a string i.e. "BREAKPOINT "
13394  *
13395  * \sa Ast::get_nmodl_name
13396  */
13397  std::string get_nmodl_name() const noexcept override {
13398  return "BREAKPOINT ";
13399  }
13400 
13401  /**
13402  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13403  */
13404  std::shared_ptr<Ast> get_shared_ptr() override {
13405  return std::static_pointer_cast<BreakpointBlock>(shared_from_this());
13406  }
13407 
13408  /**
13409  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13410  */
13411  std::shared_ptr<const Ast> get_shared_ptr() const override {
13412  return std::static_pointer_cast<const BreakpointBlock>(shared_from_this());
13413  }
13414 
13415  /**
13416  * \brief Return associated token for the current ast node
13417  *
13418  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
13419  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
13420  * nullptr to store in the nmodl::symtab::SymbolTable.
13421  *
13422  * \return pointer to token if exist otherwise nullptr
13423  */
13424  const ModToken* get_token() const noexcept override {
13425  return token.get();
13426  }
13427 
13428  /**
13429  * \brief Return associated symbol table for the current ast node
13430  *
13431  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13432  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13433  * and it can be accessed using this method.
13434  *
13435  * \return pointer to the symbol table
13436  *
13437  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13438  */
13440  return symtab;
13441  }
13442 
13443 
13444 
13445 
13446 
13447 
13448 
13449 
13450  /**
13451  * \brief Getter for member variable \ref BreakpointBlock.statement_block
13452  */
13453  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
13454  return statement_block;
13455  }
13456 
13457 
13458 
13459  /// \}
13460 
13461  /// \name Setters
13462  /// \{
13463 
13464 
13465  /**
13466  * \brief Set token for the current ast node
13467  */
13468  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
13469 
13470  /**
13471  * \brief Set symbol table for the current ast node
13472  *
13473  * Top level, block scoped nodes store symbol table in the ast node.
13474  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13475  * for every node in the ast.
13476  *
13477  * \sa nmodl::visitor::SymtabVisitor
13478  */
13479  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
13480  symtab = newsymtab;
13481  }
13482 
13483 
13484 
13485  /**
13486  * \brief Setter for member variable \ref BreakpointBlock.statement_block (rvalue reference)
13487  */
13488  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
13489 
13490  /**
13491  * \brief Setter for member variable \ref BreakpointBlock.statement_block
13492  */
13493  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
13494 
13495 
13496  /// \}
13497 
13498  /// \name Visitor
13499  /// \{
13500 
13501  /**
13502  * \brief visit children i.e. member variables of current node using provided visitor
13503  *
13504  * Different nodes in the AST have different members (i.e. children). This method
13505  * recursively visits children using provided visitor.
13506  *
13507  * \param v Concrete visitor that will be used to recursively visit children
13508  *
13509  * \sa Ast::visit_children for example.
13510  */
13511  void visit_children(visitor::Visitor& v) override;
13512 
13513  /**
13514  * \brief visit children i.e. member variables of current node using provided visitor
13515  *
13516  * Different nodes in the AST have different members (i.e. children). This method
13517  * recursively visits children using provided visitor.
13518  *
13519  * \param v Concrete constant visitor that will be used to recursively visit children
13520  *
13521  * \sa Ast::visit_children for example.
13522  */
13523  void visit_children(visitor::ConstVisitor& v) const override;
13524 
13525  /**
13526  * \brief accept (or visit) the current AST node using provided visitor
13527  *
13528  * Instead of visiting children of AST node, like Ast::visit_children,
13529  * accept allows to visit the current node itself using provided concrete
13530  * visitor.
13531  *
13532  * \param v Concrete visitor that will be used to recursively visit node
13533  *
13534  * \sa Ast::accept for example.
13535  */
13536  void accept(visitor::Visitor& v) override;
13537 
13538  /**
13539  * \copydoc accept(visitor::Visitor&)
13540  */
13541  void accept(visitor::ConstVisitor& v) const override;
13542 
13543  /// \}
13544 
13545 
13546 
13547  private:
13548  /**
13549  * \brief Set this object as parent for all the children
13550  *
13551  * This should be called in every object (with children) constructor
13552  * to set parents. Since it is called only in the constructors it
13553  * should not be virtual to avoid ambiguities (issue #295).
13554  */
13555  void set_parent_in_children();
13556 };
13557 
13558 /** @} */ // end of ast_class
13559 
13560 
13561 } // namespace ast
13562 } // namespace nmodl
13563 #endif // !NMODL_AST_BREAKPOINT_BLOCK_HPP
13564 #ifndef NMODL_AST_TERMINAL_BLOCK_HPP
13565 #define NMODL_AST_TERMINAL_BLOCK_HPP
13566 
13567 
13568 namespace nmodl {
13569 namespace ast {
13570 
13571 /**
13572  * @addtogroup ast_class
13573  * @ingroup ast
13574  * @{
13575  */
13576 
13577 /**
13578  * \brief TODO
13579  *
13580  *
13581 */
13582 class TerminalBlock : public Block {
13583  private:
13584  /// Block with statements vector
13585  std::shared_ptr<StatementBlock> statement_block;
13586  /// token with location information
13587  std::shared_ptr<ModToken> token;
13588  /// symbol table for a block
13589  symtab::SymbolTable* symtab = nullptr;
13590 
13591  public:
13592 
13593  /// \name Ctor & dtor
13594  /// \{
13595 
13596  explicit TerminalBlock(StatementBlock* statement_block);
13597  explicit TerminalBlock(const std::shared_ptr<StatementBlock>& statement_block);
13598  TerminalBlock(const TerminalBlock& obj);
13599 
13600 
13601  virtual ~TerminalBlock() = default;
13602 
13603  /// \}
13604 
13605 
13606 
13607 
13608 
13609 
13610  /**
13611  * \brief Check if the ast node is an instance of ast::TerminalBlock
13612  * \return true as object is of type ast::TerminalBlock
13613  */
13614  bool is_terminal_block () const noexcept override {
13615  return true;
13616  }
13617 
13618  /**
13619  * \brief Return a copy of the current node
13620  *
13621  * Recursively make a new copy/clone of the current node including
13622  * all members and return a pointer to the node. This is used for
13623  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13624  * ast.
13625  *
13626  * @return pointer to the clone/copy of the current node
13627  */
13628  TerminalBlock* clone() const override {
13629  return new TerminalBlock(*this);
13630  }
13631 
13632  /// \name Getters
13633  /// \{
13634 
13635  /**
13636  * \brief Return type (ast::AstNodeType) of ast node
13637  *
13638  * Every node in the ast has a type defined in ast::AstNodeType and this
13639  * function is used to retrieve the same.
13640  *
13641  * \return ast node type i.e. ast::AstNodeType::TERMINAL_BLOCK
13642  *
13643  * \sa Ast::get_node_type_name
13644  */
13645  AstNodeType get_node_type() const noexcept override {
13647  }
13648 
13649  /**
13650  * \brief Return type (ast::AstNodeType) of ast node as std::string
13651  *
13652  * Every node in the ast has a type defined in ast::AstNodeType.
13653  * This type name can be returned as a std::string for printing
13654  * node to text/json form.
13655  *
13656  * \return name of the node type as a string i.e. "TerminalBlock"
13657  *
13658  * \sa Ast::get_node_name
13659  */
13660  std::string get_node_type_name() const noexcept override {
13661  return "TerminalBlock";
13662  }
13663 
13664  /**
13665  * \brief Return NMODL statement of ast node as std::string
13666  *
13667  * Every node is related to a special statement in the NMODL. This
13668  * statement can be returned as a std::string for printing to
13669  * text/json form.
13670  *
13671  * \return name of the statement as a string i.e. "TERMINAL "
13672  *
13673  * \sa Ast::get_nmodl_name
13674  */
13675  std::string get_nmodl_name() const noexcept override {
13676  return "TERMINAL ";
13677  }
13678 
13679  /**
13680  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13681  */
13682  std::shared_ptr<Ast> get_shared_ptr() override {
13683  return std::static_pointer_cast<TerminalBlock>(shared_from_this());
13684  }
13685 
13686  /**
13687  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13688  */
13689  std::shared_ptr<const Ast> get_shared_ptr() const override {
13690  return std::static_pointer_cast<const TerminalBlock>(shared_from_this());
13691  }
13692 
13693  /**
13694  * \brief Return associated token for the current ast node
13695  *
13696  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
13697  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
13698  * nullptr to store in the nmodl::symtab::SymbolTable.
13699  *
13700  * \return pointer to token if exist otherwise nullptr
13701  */
13702  const ModToken* get_token() const noexcept override {
13703  return token.get();
13704  }
13705 
13706  /**
13707  * \brief Return associated symbol table for the current ast node
13708  *
13709  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13710  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13711  * and it can be accessed using this method.
13712  *
13713  * \return pointer to the symbol table
13714  *
13715  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13716  */
13718  return symtab;
13719  }
13720 
13721 
13722 
13723 
13724 
13725 
13726 
13727 
13728  /**
13729  * \brief Getter for member variable \ref TerminalBlock.statement_block
13730  */
13731  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
13732  return statement_block;
13733  }
13734 
13735 
13736 
13737  /// \}
13738 
13739  /// \name Setters
13740  /// \{
13741 
13742 
13743  /**
13744  * \brief Set token for the current ast node
13745  */
13746  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
13747 
13748  /**
13749  * \brief Set symbol table for the current ast node
13750  *
13751  * Top level, block scoped nodes store symbol table in the ast node.
13752  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13753  * for every node in the ast.
13754  *
13755  * \sa nmodl::visitor::SymtabVisitor
13756  */
13757  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
13758  symtab = newsymtab;
13759  }
13760 
13761 
13762 
13763  /**
13764  * \brief Setter for member variable \ref TerminalBlock.statement_block (rvalue reference)
13765  */
13766  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
13767 
13768  /**
13769  * \brief Setter for member variable \ref TerminalBlock.statement_block
13770  */
13771  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
13772 
13773 
13774  /// \}
13775 
13776  /// \name Visitor
13777  /// \{
13778 
13779  /**
13780  * \brief visit children i.e. member variables of current node using provided visitor
13781  *
13782  * Different nodes in the AST have different members (i.e. children). This method
13783  * recursively visits children using provided visitor.
13784  *
13785  * \param v Concrete visitor that will be used to recursively visit children
13786  *
13787  * \sa Ast::visit_children for example.
13788  */
13789  void visit_children(visitor::Visitor& v) override;
13790 
13791  /**
13792  * \brief visit children i.e. member variables of current node using provided visitor
13793  *
13794  * Different nodes in the AST have different members (i.e. children). This method
13795  * recursively visits children using provided visitor.
13796  *
13797  * \param v Concrete constant visitor that will be used to recursively visit children
13798  *
13799  * \sa Ast::visit_children for example.
13800  */
13801  void visit_children(visitor::ConstVisitor& v) const override;
13802 
13803  /**
13804  * \brief accept (or visit) the current AST node using provided visitor
13805  *
13806  * Instead of visiting children of AST node, like Ast::visit_children,
13807  * accept allows to visit the current node itself using provided concrete
13808  * visitor.
13809  *
13810  * \param v Concrete visitor that will be used to recursively visit node
13811  *
13812  * \sa Ast::accept for example.
13813  */
13814  void accept(visitor::Visitor& v) override;
13815 
13816  /**
13817  * \copydoc accept(visitor::Visitor&)
13818  */
13819  void accept(visitor::ConstVisitor& v) const override;
13820 
13821  /// \}
13822 
13823 
13824 
13825  private:
13826  /**
13827  * \brief Set this object as parent for all the children
13828  *
13829  * This should be called in every object (with children) constructor
13830  * to set parents. Since it is called only in the constructors it
13831  * should not be virtual to avoid ambiguities (issue #295).
13832  */
13833  void set_parent_in_children();
13834 };
13835 
13836 /** @} */ // end of ast_class
13837 
13838 
13839 } // namespace ast
13840 } // namespace nmodl
13841 #endif // !NMODL_AST_TERMINAL_BLOCK_HPP
13842 #ifndef NMODL_AST_BEFORE_BLOCK_HPP
13843 #define NMODL_AST_BEFORE_BLOCK_HPP
13844 
13845 
13846 namespace nmodl {
13847 namespace ast {
13848 
13849 /**
13850  * @addtogroup ast_class
13851  * @ingroup ast
13852  * @{
13853  */
13854 
13855 /**
13856  * \brief Represents a `BEFORE` block in NMODL
13857  *
13858  *
13859 */
13860 class BeforeBlock : public Block {
13861  private:
13862  /// Block to be called before
13863  std::shared_ptr<BABlock> bablock;
13864  /// token with location information
13865  std::shared_ptr<ModToken> token;
13866  /// symbol table for a block
13867  symtab::SymbolTable* symtab = nullptr;
13868 
13869  public:
13870 
13871  /// \name Ctor & dtor
13872  /// \{
13873 
13874  explicit BeforeBlock(BABlock* bablock);
13875  explicit BeforeBlock(const std::shared_ptr<BABlock>& bablock);
13876  BeforeBlock(const BeforeBlock& obj);
13877 
13878 
13879  virtual ~BeforeBlock() = default;
13880 
13881  /// \}
13882 
13883 
13884 
13885 
13886 
13887 
13888  /**
13889  * \brief Check if the ast node is an instance of ast::BeforeBlock
13890  * \return true as object is of type ast::BeforeBlock
13891  */
13892  bool is_before_block () const noexcept override {
13893  return true;
13894  }
13895 
13896  /**
13897  * \brief Return a copy of the current node
13898  *
13899  * Recursively make a new copy/clone of the current node including
13900  * all members and return a pointer to the node. This is used for
13901  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13902  * ast.
13903  *
13904  * @return pointer to the clone/copy of the current node
13905  */
13906  BeforeBlock* clone() const override {
13907  return new BeforeBlock(*this);
13908  }
13909 
13910  /// \name Getters
13911  /// \{
13912 
13913  /**
13914  * \brief Return type (ast::AstNodeType) of ast node
13915  *
13916  * Every node in the ast has a type defined in ast::AstNodeType and this
13917  * function is used to retrieve the same.
13918  *
13919  * \return ast node type i.e. ast::AstNodeType::BEFORE_BLOCK
13920  *
13921  * \sa Ast::get_node_type_name
13922  */
13923  AstNodeType get_node_type() const noexcept override {
13925  }
13926 
13927  /**
13928  * \brief Return type (ast::AstNodeType) of ast node as std::string
13929  *
13930  * Every node in the ast has a type defined in ast::AstNodeType.
13931  * This type name can be returned as a std::string for printing
13932  * node to text/json form.
13933  *
13934  * \return name of the node type as a string i.e. "BeforeBlock"
13935  *
13936  * \sa Ast::get_node_name
13937  */
13938  std::string get_node_type_name() const noexcept override {
13939  return "BeforeBlock";
13940  }
13941 
13942  /**
13943  * \brief Return NMODL statement of ast node as std::string
13944  *
13945  * Every node is related to a special statement in the NMODL. This
13946  * statement can be returned as a std::string for printing to
13947  * text/json form.
13948  *
13949  * \return name of the statement as a string i.e. "BEFORE "
13950  *
13951  * \sa Ast::get_nmodl_name
13952  */
13953  std::string get_nmodl_name() const noexcept override {
13954  return "BEFORE ";
13955  }
13956 
13957  /**
13958  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13959  */
13960  std::shared_ptr<Ast> get_shared_ptr() override {
13961  return std::static_pointer_cast<BeforeBlock>(shared_from_this());
13962  }
13963 
13964  /**
13965  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13966  */
13967  std::shared_ptr<const Ast> get_shared_ptr() const override {
13968  return std::static_pointer_cast<const BeforeBlock>(shared_from_this());
13969  }
13970 
13971  /**
13972  * \brief Return associated token for the current ast node
13973  *
13974  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
13975  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
13976  * nullptr to store in the nmodl::symtab::SymbolTable.
13977  *
13978  * \return pointer to token if exist otherwise nullptr
13979  */
13980  const ModToken* get_token() const noexcept override {
13981  return token.get();
13982  }
13983 
13984  /**
13985  * \brief Return associated symbol table for the current ast node
13986  *
13987  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13988  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13989  * and it can be accessed using this method.
13990  *
13991  * \return pointer to the symbol table
13992  *
13993  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13994  */
13996  return symtab;
13997  }
13998 
13999 
14000 
14001 
14002 
14003 
14004 
14005 
14006  /**
14007  * \brief Getter for member variable \ref BeforeBlock.bablock
14008  */
14009  const std::shared_ptr<BABlock>& get_bablock() const noexcept {
14010  return bablock;
14011  }
14012 
14013 
14014 
14015  /// \}
14016 
14017  /// \name Setters
14018  /// \{
14019 
14020 
14021  /**
14022  * \brief Set token for the current ast node
14023  */
14024  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
14025 
14026  /**
14027  * \brief Set symbol table for the current ast node
14028  *
14029  * Top level, block scoped nodes store symbol table in the ast node.
14030  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
14031  * for every node in the ast.
14032  *
14033  * \sa nmodl::visitor::SymtabVisitor
14034  */
14035  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
14036  symtab = newsymtab;
14037  }
14038 
14039 
14040 
14041  /**
14042  * \brief Setter for member variable \ref BeforeBlock.bablock (rvalue reference)
14043  */
14044  void set_bablock(std::shared_ptr<BABlock>&& bablock);
14045 
14046  /**
14047  * \brief Setter for member variable \ref BeforeBlock.bablock
14048  */
14049  void set_bablock(const std::shared_ptr<BABlock>& bablock);
14050 
14051 
14052  /// \}
14053 
14054  /// \name Visitor
14055  /// \{
14056 
14057  /**
14058  * \brief visit children i.e. member variables of current node using provided visitor
14059  *
14060  * Different nodes in the AST have different members (i.e. children). This method
14061  * recursively visits children using provided visitor.
14062  *
14063  * \param v Concrete visitor that will be used to recursively visit children
14064  *
14065  * \sa Ast::visit_children for example.
14066  */
14067  void visit_children(visitor::Visitor& v) override;
14068 
14069  /**
14070  * \brief visit children i.e. member variables of current node using provided visitor
14071  *
14072  * Different nodes in the AST have different members (i.e. children). This method
14073  * recursively visits children using provided visitor.
14074  *
14075  * \param v Concrete constant visitor that will be used to recursively visit children
14076  *
14077  * \sa Ast::visit_children for example.
14078  */
14079  void visit_children(visitor::ConstVisitor& v) const override;
14080 
14081  /**
14082  * \brief accept (or visit) the current AST node using provided visitor
14083  *
14084  * Instead of visiting children of AST node, like Ast::visit_children,
14085  * accept allows to visit the current node itself using provided concrete
14086  * visitor.
14087  *
14088  * \param v Concrete visitor that will be used to recursively visit node
14089  *
14090  * \sa Ast::accept for example.
14091  */
14092  void accept(visitor::Visitor& v) override;
14093 
14094  /**
14095  * \copydoc accept(visitor::Visitor&)
14096  */
14097  void accept(visitor::ConstVisitor& v) const override;
14098 
14099  /// \}
14100 
14101 
14102 
14103  private:
14104  /**
14105  * \brief Set this object as parent for all the children
14106  *
14107  * This should be called in every object (with children) constructor
14108  * to set parents. Since it is called only in the constructors it
14109  * should not be virtual to avoid ambiguities (issue #295).
14110  */
14111  void set_parent_in_children();
14112 };
14113 
14114 /** @} */ // end of ast_class
14115 
14116 
14117 } // namespace ast
14118 } // namespace nmodl
14119 #endif // !NMODL_AST_BEFORE_BLOCK_HPP
14120 #ifndef NMODL_AST_AFTER_BLOCK_HPP
14121 #define NMODL_AST_AFTER_BLOCK_HPP
14122 
14123 
14124 namespace nmodl {
14125 namespace ast {
14126 
14127 /**
14128  * @addtogroup ast_class
14129  * @ingroup ast
14130  * @{
14131  */
14132 
14133 /**
14134  * \brief Represents a `AFTER` block in NMODL
14135  *
14136  * This represents a block to be executed before another block.
14137  * Here is an example of `BEFORE` :
14138  *
14139  * \code{.mod}
14140  * BEFORE STEP {
14141  * if (mode==1) {
14142  * if (ica<imax) {
14143  * imax = ica
14144  * timax = t
14145  * }
14146  * }
14147  * }
14148  * \endcode
14149  *
14150 */
14151 class AfterBlock : public Block {
14152  private:
14153  /// Block to be called after
14154  std::shared_ptr<BABlock> bablock;
14155  /// token with location information
14156  std::shared_ptr<ModToken> token;
14157  /// symbol table for a block
14158  symtab::SymbolTable* symtab = nullptr;
14159 
14160  public:
14161 
14162  /// \name Ctor & dtor
14163  /// \{
14164 
14165  explicit AfterBlock(BABlock* bablock);
14166  explicit AfterBlock(const std::shared_ptr<BABlock>& bablock);
14167  AfterBlock(const AfterBlock& obj);
14168 
14169 
14170  virtual ~AfterBlock() = default;
14171 
14172  /// \}
14173 
14174 
14175 
14176 
14177 
14178 
14179  /**
14180  * \brief Check if the ast node is an instance of ast::AfterBlock
14181  * \return true as object is of type ast::AfterBlock
14182  */
14183  bool is_after_block () const noexcept override {
14184  return true;
14185  }
14186 
14187  /**
14188  * \brief Return a copy of the current node
14189  *
14190  * Recursively make a new copy/clone of the current node including
14191  * all members and return a pointer to the node. This is used for
14192  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14193  * ast.
14194  *
14195  * @return pointer to the clone/copy of the current node
14196  */
14197  AfterBlock* clone() const override {
14198  return new AfterBlock(*this);
14199  }
14200 
14201  /// \name Getters
14202  /// \{
14203 
14204  /**
14205  * \brief Return type (ast::AstNodeType) of ast node
14206  *
14207  * Every node in the ast has a type defined in ast::AstNodeType and this
14208  * function is used to retrieve the same.
14209  *
14210  * \return ast node type i.e. ast::AstNodeType::AFTER_BLOCK
14211  *
14212  * \sa Ast::get_node_type_name
14213  */
14214  AstNodeType get_node_type() const noexcept override {
14215  return AstNodeType::AFTER_BLOCK;
14216  }
14217 
14218  /**
14219  * \brief Return type (ast::AstNodeType) of ast node as std::string
14220  *
14221  * Every node in the ast has a type defined in ast::AstNodeType.
14222  * This type name can be returned as a std::string for printing
14223  * node to text/json form.
14224  *
14225  * \return name of the node type as a string i.e. "AfterBlock"
14226  *
14227  * \sa Ast::get_node_name
14228  */
14229  std::string get_node_type_name() const noexcept override {
14230  return "AfterBlock";
14231  }
14232 
14233  /**
14234  * \brief Return NMODL statement of ast node as std::string
14235  *
14236  * Every node is related to a special statement in the NMODL. This
14237  * statement can be returned as a std::string for printing to
14238  * text/json form.
14239  *
14240  * \return name of the statement as a string i.e. "AFTER "
14241  *
14242  * \sa Ast::get_nmodl_name
14243  */
14244  std::string get_nmodl_name() const noexcept override {
14245  return "AFTER ";
14246  }
14247 
14248  /**
14249  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14250  */
14251  std::shared_ptr<Ast> get_shared_ptr() override {
14252  return std::static_pointer_cast<AfterBlock>(shared_from_this());
14253  }
14254 
14255  /**
14256  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14257  */
14258  std::shared_ptr<const Ast> get_shared_ptr() const override {
14259  return std::static_pointer_cast<const AfterBlock>(shared_from_this());
14260  }
14261 
14262  /**
14263  * \brief Return associated token for the current ast node
14264  *
14265  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
14266  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
14267  * nullptr to store in the nmodl::symtab::SymbolTable.
14268  *
14269  * \return pointer to token if exist otherwise nullptr
14270  */
14271  const ModToken* get_token() const noexcept override {
14272  return token.get();
14273  }
14274 
14275  /**
14276  * \brief Return associated symbol table for the current ast node
14277  *
14278  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
14279  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
14280  * and it can be accessed using this method.
14281  *
14282  * \return pointer to the symbol table
14283  *
14284  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
14285  */
14287  return symtab;
14288  }
14289 
14290 
14291 
14292 
14293 
14294 
14295 
14296 
14297  /**
14298  * \brief Getter for member variable \ref AfterBlock.bablock
14299  */
14300  const std::shared_ptr<BABlock>& get_bablock() const noexcept {
14301  return bablock;
14302  }
14303 
14304 
14305 
14306  /// \}
14307 
14308  /// \name Setters
14309  /// \{
14310 
14311 
14312  /**
14313  * \brief Set token for the current ast node
14314  */
14315  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
14316 
14317  /**
14318  * \brief Set symbol table for the current ast node
14319  *
14320  * Top level, block scoped nodes store symbol table in the ast node.
14321  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
14322  * for every node in the ast.
14323  *
14324  * \sa nmodl::visitor::SymtabVisitor
14325  */
14326  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
14327  symtab = newsymtab;
14328  }
14329 
14330 
14331 
14332  /**
14333  * \brief Setter for member variable \ref AfterBlock.bablock (rvalue reference)
14334  */
14335  void set_bablock(std::shared_ptr<BABlock>&& bablock);
14336 
14337  /**
14338  * \brief Setter for member variable \ref AfterBlock.bablock
14339  */
14340  void set_bablock(const std::shared_ptr<BABlock>& bablock);
14341 
14342 
14343  /// \}
14344 
14345  /// \name Visitor
14346  /// \{
14347 
14348  /**
14349  * \brief visit children i.e. member variables of current node using provided visitor
14350  *
14351  * Different nodes in the AST have different members (i.e. children). This method
14352  * recursively visits children using provided visitor.
14353  *
14354  * \param v Concrete visitor that will be used to recursively visit children
14355  *
14356  * \sa Ast::visit_children for example.
14357  */
14358  void visit_children(visitor::Visitor& v) override;
14359 
14360  /**
14361  * \brief visit children i.e. member variables of current node using provided visitor
14362  *
14363  * Different nodes in the AST have different members (i.e. children). This method
14364  * recursively visits children using provided visitor.
14365  *
14366  * \param v Concrete constant visitor that will be used to recursively visit children
14367  *
14368  * \sa Ast::visit_children for example.
14369  */
14370  void visit_children(visitor::ConstVisitor& v) const override;
14371 
14372  /**
14373  * \brief accept (or visit) the current AST node using provided visitor
14374  *
14375  * Instead of visiting children of AST node, like Ast::visit_children,
14376  * accept allows to visit the current node itself using provided concrete
14377  * visitor.
14378  *
14379  * \param v Concrete visitor that will be used to recursively visit node
14380  *
14381  * \sa Ast::accept for example.
14382  */
14383  void accept(visitor::Visitor& v) override;
14384 
14385  /**
14386  * \copydoc accept(visitor::Visitor&)
14387  */
14388  void accept(visitor::ConstVisitor& v) const override;
14389 
14390  /// \}
14391 
14392 
14393 
14394  private:
14395  /**
14396  * \brief Set this object as parent for all the children
14397  *
14398  * This should be called in every object (with children) constructor
14399  * to set parents. Since it is called only in the constructors it
14400  * should not be virtual to avoid ambiguities (issue #295).
14401  */
14402  void set_parent_in_children();
14403 };
14404 
14405 /** @} */ // end of ast_class
14406 
14407 
14408 } // namespace ast
14409 } // namespace nmodl
14410 #endif // !NMODL_AST_AFTER_BLOCK_HPP
14411 #ifndef NMODL_AST_BA_BLOCK_HPP
14412 #define NMODL_AST_BA_BLOCK_HPP
14413 
14414 
14415 namespace nmodl {
14416 namespace ast {
14417 
14418 /**
14419  * @addtogroup ast_class
14420  * @ingroup ast
14421  * @{
14422  */
14423 
14424 /**
14425  * \brief Represents a block to be executed before or after another block
14426  *
14427  * This represents a block to be executed before or after another
14428  * block in NMODL. See ast::BeforeBlock and ast::AfterBlock for usage.
14429  *
14430 */
14431 class BABlock : public Block {
14432  private:
14433  /// Type of NMODL block
14434  std::shared_ptr<BABlockType> type;
14435  /// Block with statements vector
14436  std::shared_ptr<StatementBlock> statement_block;
14437  /// token with location information
14438  std::shared_ptr<ModToken> token;
14439  /// symbol table for a block
14440  symtab::SymbolTable* symtab = nullptr;
14441 
14442  public:
14443 
14444  /// \name Ctor & dtor
14445  /// \{
14446 
14447  explicit BABlock(BABlockType* type, StatementBlock* statement_block);
14448  explicit BABlock(const std::shared_ptr<BABlockType>& type, const std::shared_ptr<StatementBlock>& statement_block);
14449  BABlock(const BABlock& obj);
14450 
14451 
14452  virtual ~BABlock() = default;
14453 
14454  /// \}
14455 
14456 
14457 
14458 
14459 
14460 
14461  /**
14462  * \brief Check if the ast node is an instance of ast::BABlock
14463  * \return true as object is of type ast::BABlock
14464  */
14465  bool is_ba_block () const noexcept override {
14466  return true;
14467  }
14468 
14469  /**
14470  * \brief Return a copy of the current node
14471  *
14472  * Recursively make a new copy/clone of the current node including
14473  * all members and return a pointer to the node. This is used for
14474  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14475  * ast.
14476  *
14477  * @return pointer to the clone/copy of the current node
14478  */
14479  BABlock* clone() const override {
14480  return new BABlock(*this);
14481  }
14482 
14483  /// \name Getters
14484  /// \{
14485 
14486  /**
14487  * \brief Return type (ast::AstNodeType) of ast node
14488  *
14489  * Every node in the ast has a type defined in ast::AstNodeType and this
14490  * function is used to retrieve the same.
14491  *
14492  * \return ast node type i.e. ast::AstNodeType::BA_BLOCK
14493  *
14494  * \sa Ast::get_node_type_name
14495  */
14496  AstNodeType get_node_type() const noexcept override {
14497  return AstNodeType::BA_BLOCK;
14498  }
14499 
14500  /**
14501  * \brief Return type (ast::AstNodeType) of ast node as std::string
14502  *
14503  * Every node in the ast has a type defined in ast::AstNodeType.
14504  * This type name can be returned as a std::string for printing
14505  * node to text/json form.
14506  *
14507  * \return name of the node type as a string i.e. "BABlock"
14508  *
14509  * \sa Ast::get_node_name
14510  */
14511  std::string get_node_type_name() const noexcept override {
14512  return "BABlock";
14513  }
14514 
14515 
14516  /**
14517  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14518  */
14519  std::shared_ptr<Ast> get_shared_ptr() override {
14520  return std::static_pointer_cast<BABlock>(shared_from_this());
14521  }
14522 
14523  /**
14524  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14525  */
14526  std::shared_ptr<const Ast> get_shared_ptr() const override {
14527  return std::static_pointer_cast<const BABlock>(shared_from_this());
14528  }
14529 
14530  /**
14531  * \brief Return associated token for the current ast node
14532  *
14533  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
14534  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
14535  * nullptr to store in the nmodl::symtab::SymbolTable.
14536  *
14537  * \return pointer to token if exist otherwise nullptr
14538  */
14539  const ModToken* get_token() const noexcept override {
14540  return token.get();
14541  }
14542 
14543  /**
14544  * \brief Return associated symbol table for the current ast node
14545  *
14546  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
14547  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
14548  * and it can be accessed using this method.
14549  *
14550  * \return pointer to the symbol table
14551  *
14552  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
14553  */
14555  return symtab;
14556  }
14557 
14558 
14559 
14560 
14561 
14562 
14563 
14564 
14565  /**
14566  * \brief Getter for member variable \ref BABlock.type
14567  */
14568  const std::shared_ptr<BABlockType>& get_type() const noexcept {
14569  return type;
14570  }
14571 
14572 
14573 
14574 
14575 
14576 
14577 
14578  /**
14579  * \brief Getter for member variable \ref BABlock.statement_block
14580  */
14581  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
14582  return statement_block;
14583  }
14584 
14585 
14586 
14587  /// \}
14588 
14589  /// \name Setters
14590  /// \{
14591 
14592 
14593  /**
14594  * \brief Set token for the current ast node
14595  */
14596  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
14597 
14598  /**
14599  * \brief Set symbol table for the current ast node
14600  *
14601  * Top level, block scoped nodes store symbol table in the ast node.
14602  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
14603  * for every node in the ast.
14604  *
14605  * \sa nmodl::visitor::SymtabVisitor
14606  */
14607  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
14608  symtab = newsymtab;
14609  }
14610 
14611 
14612 
14613  /**
14614  * \brief Setter for member variable \ref BABlock.type (rvalue reference)
14615  */
14616  void set_type(std::shared_ptr<BABlockType>&& type);
14617 
14618  /**
14619  * \brief Setter for member variable \ref BABlock.type
14620  */
14621  void set_type(const std::shared_ptr<BABlockType>& type);
14622 
14623 
14624  /**
14625  * \brief Setter for member variable \ref BABlock.statement_block (rvalue reference)
14626  */
14627  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
14628 
14629  /**
14630  * \brief Setter for member variable \ref BABlock.statement_block
14631  */
14632  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
14633 
14634 
14635  /// \}
14636 
14637  /// \name Visitor
14638  /// \{
14639 
14640  /**
14641  * \brief visit children i.e. member variables of current node using provided visitor
14642  *
14643  * Different nodes in the AST have different members (i.e. children). This method
14644  * recursively visits children using provided visitor.
14645  *
14646  * \param v Concrete visitor that will be used to recursively visit children
14647  *
14648  * \sa Ast::visit_children for example.
14649  */
14650  void visit_children(visitor::Visitor& v) override;
14651 
14652  /**
14653  * \brief visit children i.e. member variables of current node using provided visitor
14654  *
14655  * Different nodes in the AST have different members (i.e. children). This method
14656  * recursively visits children using provided visitor.
14657  *
14658  * \param v Concrete constant visitor that will be used to recursively visit children
14659  *
14660  * \sa Ast::visit_children for example.
14661  */
14662  void visit_children(visitor::ConstVisitor& v) const override;
14663 
14664  /**
14665  * \brief accept (or visit) the current AST node using provided visitor
14666  *
14667  * Instead of visiting children of AST node, like Ast::visit_children,
14668  * accept allows to visit the current node itself using provided concrete
14669  * visitor.
14670  *
14671  * \param v Concrete visitor that will be used to recursively visit node
14672  *
14673  * \sa Ast::accept for example.
14674  */
14675  void accept(visitor::Visitor& v) override;
14676 
14677  /**
14678  * \copydoc accept(visitor::Visitor&)
14679  */
14680  void accept(visitor::ConstVisitor& v) const override;
14681 
14682  /// \}
14683 
14684 
14685 
14686  private:
14687  /**
14688  * \brief Set this object as parent for all the children
14689  *
14690  * This should be called in every object (with children) constructor
14691  * to set parents. Since it is called only in the constructors it
14692  * should not be virtual to avoid ambiguities (issue #295).
14693  */
14694  void set_parent_in_children();
14695 };
14696 
14697 /** @} */ // end of ast_class
14698 
14699 
14700 } // namespace ast
14701 } // namespace nmodl
14702 #endif // !NMODL_AST_BA_BLOCK_HPP
14703 #ifndef NMODL_AST_FOR_NETCON_HPP
14704 #define NMODL_AST_FOR_NETCON_HPP
14705 
14706 
14707 namespace nmodl {
14708 namespace ast {
14709 
14710 /**
14711  * @addtogroup ast_class
14712  * @ingroup ast
14713  * @{
14714  */
14715 
14716 /**
14717  * \brief TODO
14718  *
14719  *
14720 */
14721 class ForNetcon : public Block {
14722  private:
14723  /// Arguments to the for netcon block
14725  /// Block with statements vector
14726  std::shared_ptr<StatementBlock> statement_block;
14727  /// token with location information
14728  std::shared_ptr<ModToken> token;
14729  /// symbol table for a block
14730  symtab::SymbolTable* symtab = nullptr;
14731 
14732  public:
14733 
14734  /// \name Ctor & dtor
14735  /// \{
14736 
14737  explicit ForNetcon(ArgumentVector parameters, StatementBlock* statement_block);
14738  explicit ForNetcon(const ArgumentVector& parameters, const std::shared_ptr<StatementBlock>& statement_block);
14739  ForNetcon(const ForNetcon& obj);
14740 
14741 
14742  virtual ~ForNetcon() = default;
14743 
14744  /// \}
14745 
14746 
14747 
14748 
14749 
14750 
14751  /**
14752  * \brief Check if the ast node is an instance of ast::ForNetcon
14753  * \return true as object is of type ast::ForNetcon
14754  */
14755  bool is_for_netcon () const noexcept override {
14756  return true;
14757  }
14758 
14759  /**
14760  * \brief Return a copy of the current node
14761  *
14762  * Recursively make a new copy/clone of the current node including
14763  * all members and return a pointer to the node. This is used for
14764  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14765  * ast.
14766  *
14767  * @return pointer to the clone/copy of the current node
14768  */
14769  ForNetcon* clone() const override {
14770  return new ForNetcon(*this);
14771  }
14772 
14773  /// \name Getters
14774  /// \{
14775 
14776  /**
14777  * \brief Return type (ast::AstNodeType) of ast node
14778  *
14779  * Every node in the ast has a type defined in ast::AstNodeType and this
14780  * function is used to retrieve the same.
14781  *
14782  * \return ast node type i.e. ast::AstNodeType::FOR_NETCON
14783  *
14784  * \sa Ast::get_node_type_name
14785  */
14786  AstNodeType get_node_type() const noexcept override {
14787  return AstNodeType::FOR_NETCON;
14788  }
14789 
14790  /**
14791  * \brief Return type (ast::AstNodeType) of ast node as std::string
14792  *
14793  * Every node in the ast has a type defined in ast::AstNodeType.
14794  * This type name can be returned as a std::string for printing
14795  * node to text/json form.
14796  *
14797  * \return name of the node type as a string i.e. "ForNetcon"
14798  *
14799  * \sa Ast::get_node_name
14800  */
14801  std::string get_node_type_name() const noexcept override {
14802  return "ForNetcon";
14803  }
14804 
14805  /**
14806  * \brief Return NMODL statement of ast node as std::string
14807  *
14808  * Every node is related to a special statement in the NMODL. This
14809  * statement can be returned as a std::string for printing to
14810  * text/json form.
14811  *
14812  * \return name of the statement as a string i.e. "FOR_NETCONS "
14813  *
14814  * \sa Ast::get_nmodl_name
14815  */
14816  std::string get_nmodl_name() const noexcept override {
14817  return "FOR_NETCONS ";
14818  }
14819 
14820  /**
14821  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14822  */
14823  std::shared_ptr<Ast> get_shared_ptr() override {
14824  return std::static_pointer_cast<ForNetcon>(shared_from_this());
14825  }
14826 
14827  /**
14828  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14829  */
14830  std::shared_ptr<const Ast> get_shared_ptr() const override {
14831  return std::static_pointer_cast<const ForNetcon>(shared_from_this());
14832  }
14833 
14834  /**
14835  * \brief Return associated token for the current ast node
14836  *
14837  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
14838  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
14839  * nullptr to store in the nmodl::symtab::SymbolTable.
14840  *
14841  * \return pointer to token if exist otherwise nullptr
14842  */
14843  const ModToken* get_token() const noexcept override {
14844  return token.get();
14845  }
14846 
14847  /**
14848  * \brief Return associated symbol table for the current ast node
14849  *
14850  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
14851  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
14852  * and it can be accessed using this method.
14853  *
14854  * \return pointer to the symbol table
14855  *
14856  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
14857  */
14859  return symtab;
14860  }
14861 
14862 
14863 
14864 
14865 
14866 
14867 
14868 
14869  /**
14870  * \brief Getter for member variable \ref ForNetcon.parameters
14871  */
14872  const ArgumentVector& get_parameters() const noexcept override {
14873  return parameters;
14874  }
14875 
14876 
14877 
14878 
14879 
14880 
14881 
14882  /**
14883  * \brief Getter for member variable \ref ForNetcon.statement_block
14884  */
14885  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
14886  return statement_block;
14887  }
14888 
14889 
14890 
14891  /// \}
14892 
14893  /// \name Setters
14894  /// \{
14895 
14896 
14897  /**
14898  * \brief Set token for the current ast node
14899  */
14900  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
14901 
14902  /**
14903  * \brief Set symbol table for the current ast node
14904  *
14905  * Top level, block scoped nodes store symbol table in the ast node.
14906  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
14907  * for every node in the ast.
14908  *
14909  * \sa nmodl::visitor::SymtabVisitor
14910  */
14911  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
14912  symtab = newsymtab;
14913  }
14914 
14915 
14916 
14917  /**
14918  * \brief Setter for member variable \ref ForNetcon.parameters (rvalue reference)
14919  */
14920  void set_parameters(ArgumentVector&& parameters);
14921 
14922  /**
14923  * \brief Setter for member variable \ref ForNetcon.parameters
14924  */
14925  void set_parameters(const ArgumentVector& parameters);
14926 
14927 
14928  /**
14929  * \brief Setter for member variable \ref ForNetcon.statement_block (rvalue reference)
14930  */
14931  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
14932 
14933  /**
14934  * \brief Setter for member variable \ref ForNetcon.statement_block
14935  */
14936  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
14937 
14938 
14939  /// \}
14940 
14941  /// \name Visitor
14942  /// \{
14943 
14944  /**
14945  * \brief visit children i.e. member variables of current node using provided visitor
14946  *
14947  * Different nodes in the AST have different members (i.e. children). This method
14948  * recursively visits children using provided visitor.
14949  *
14950  * \param v Concrete visitor that will be used to recursively visit children
14951  *
14952  * \sa Ast::visit_children for example.
14953  */
14954  void visit_children(visitor::Visitor& v) override;
14955 
14956  /**
14957  * \brief visit children i.e. member variables of current node using provided visitor
14958  *
14959  * Different nodes in the AST have different members (i.e. children). This method
14960  * recursively visits children using provided visitor.
14961  *
14962  * \param v Concrete constant visitor that will be used to recursively visit children
14963  *
14964  * \sa Ast::visit_children for example.
14965  */
14966  void visit_children(visitor::ConstVisitor& v) const override;
14967 
14968  /**
14969  * \brief accept (or visit) the current AST node using provided visitor
14970  *
14971  * Instead of visiting children of AST node, like Ast::visit_children,
14972  * accept allows to visit the current node itself using provided concrete
14973  * visitor.
14974  *
14975  * \param v Concrete visitor that will be used to recursively visit node
14976  *
14977  * \sa Ast::accept for example.
14978  */
14979  void accept(visitor::Visitor& v) override;
14980 
14981  /**
14982  * \copydoc accept(visitor::Visitor&)
14983  */
14984  void accept(visitor::ConstVisitor& v) const override;
14985 
14986  /// \}
14987 
14988 
14989 
14990  private:
14991  /**
14992  * \brief Set this object as parent for all the children
14993  *
14994  * This should be called in every object (with children) constructor
14995  * to set parents. Since it is called only in the constructors it
14996  * should not be virtual to avoid ambiguities (issue #295).
14997  */
14998  void set_parent_in_children();
14999 };
15000 
15001 /** @} */ // end of ast_class
15002 
15003 
15004 } // namespace ast
15005 } // namespace nmodl
15006 #endif // !NMODL_AST_FOR_NETCON_HPP
15007 #ifndef NMODL_AST_KINETIC_BLOCK_HPP
15008 #define NMODL_AST_KINETIC_BLOCK_HPP
15009 
15010 
15011 namespace nmodl {
15012 namespace ast {
15013 
15014 /**
15015  * @addtogroup ast_class
15016  * @ingroup ast
15017  * @{
15018  */
15019 
15020 /**
15021  * \brief TODO
15022  *
15023  *
15024 */
15025 class KineticBlock : public Block {
15026  private:
15027  /// Name of the kinetic block
15028  std::shared_ptr<Name> name;
15029  /// Solve for specification (TODO)
15031  /// Block with statements vector
15032  std::shared_ptr<StatementBlock> statement_block;
15033  /// token with location information
15034  std::shared_ptr<ModToken> token;
15035  /// symbol table for a block
15036  symtab::SymbolTable* symtab = nullptr;
15037 
15038  public:
15039 
15040  /// \name Ctor & dtor
15041  /// \{
15042 
15043  explicit KineticBlock(Name* name, NameVector solvefor, StatementBlock* statement_block);
15044  explicit KineticBlock(const std::shared_ptr<Name>& name, const NameVector& solvefor, const std::shared_ptr<StatementBlock>& statement_block);
15045  KineticBlock(const KineticBlock& obj);
15046 
15047 
15048  virtual ~KineticBlock() = default;
15049 
15050  /// \}
15051 
15052 
15053 
15054 
15055 
15056 
15057  /**
15058  * \brief Check if the ast node is an instance of ast::KineticBlock
15059  * \return true as object is of type ast::KineticBlock
15060  */
15061  bool is_kinetic_block () const noexcept override {
15062  return true;
15063  }
15064 
15065  /**
15066  * \brief Return a copy of the current node
15067  *
15068  * Recursively make a new copy/clone of the current node including
15069  * all members and return a pointer to the node. This is used for
15070  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15071  * ast.
15072  *
15073  * @return pointer to the clone/copy of the current node
15074  */
15075  KineticBlock* clone() const override {
15076  return new KineticBlock(*this);
15077  }
15078 
15079  /// \name Getters
15080  /// \{
15081 
15082  /**
15083  * \brief Return type (ast::AstNodeType) of ast node
15084  *
15085  * Every node in the ast has a type defined in ast::AstNodeType and this
15086  * function is used to retrieve the same.
15087  *
15088  * \return ast node type i.e. ast::AstNodeType::KINETIC_BLOCK
15089  *
15090  * \sa Ast::get_node_type_name
15091  */
15092  AstNodeType get_node_type() const noexcept override {
15094  }
15095 
15096  /**
15097  * \brief Return type (ast::AstNodeType) of ast node as std::string
15098  *
15099  * Every node in the ast has a type defined in ast::AstNodeType.
15100  * This type name can be returned as a std::string for printing
15101  * node to text/json form.
15102  *
15103  * \return name of the node type as a string i.e. "KineticBlock"
15104  *
15105  * \sa Ast::get_node_name
15106  */
15107  std::string get_node_type_name() const noexcept override {
15108  return "KineticBlock";
15109  }
15110 
15111  /**
15112  * \brief Return NMODL statement of ast node as std::string
15113  *
15114  * Every node is related to a special statement in the NMODL. This
15115  * statement can be returned as a std::string for printing to
15116  * text/json form.
15117  *
15118  * \return name of the statement as a string i.e. "KINETIC "
15119  *
15120  * \sa Ast::get_nmodl_name
15121  */
15122  std::string get_nmodl_name() const noexcept override {
15123  return "KINETIC ";
15124  }
15125 
15126  /**
15127  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15128  */
15129  std::shared_ptr<Ast> get_shared_ptr() override {
15130  return std::static_pointer_cast<KineticBlock>(shared_from_this());
15131  }
15132 
15133  /**
15134  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15135  */
15136  std::shared_ptr<const Ast> get_shared_ptr() const override {
15137  return std::static_pointer_cast<const KineticBlock>(shared_from_this());
15138  }
15139 
15140  /**
15141  * \brief Return associated token for the current ast node
15142  *
15143  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
15144  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
15145  * nullptr to store in the nmodl::symtab::SymbolTable.
15146  *
15147  * \return pointer to token if exist otherwise nullptr
15148  */
15149  const ModToken* get_token() const noexcept override {
15150  return token.get();
15151  }
15152 
15153  /**
15154  * \brief Return associated symbol table for the current ast node
15155  *
15156  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
15157  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
15158  * and it can be accessed using this method.
15159  *
15160  * \return pointer to the symbol table
15161  *
15162  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
15163  */
15165  return symtab;
15166  }
15167 
15168 
15169 
15170 
15171 
15172 
15173 /**
15174  * \brief Return name of the node
15175  *
15176  * Some ast nodes have a member marked designated as node name. For example,
15177  * in case of this ast::Name has name designated as a
15178  * node name.
15179  *
15180  * @return name of the node as std::string
15181  *
15182  * \sa Ast::get_node_type_name
15183  */
15184 std::string get_node_name() const override;
15185 
15186 
15187  /**
15188  * \brief Getter for member variable \ref KineticBlock.name
15189  */
15190  const std::shared_ptr<Name>& get_name() const noexcept {
15191  return name;
15192  }
15193 
15194 
15195 
15196 
15197 
15198 
15199 
15200  /**
15201  * \brief Getter for member variable \ref KineticBlock.solvefor
15202  */
15203  const NameVector& get_solvefor() const noexcept {
15204  return solvefor;
15205  }
15206 
15207 
15208 
15209 
15210 
15211 
15212 
15213  /**
15214  * \brief Getter for member variable \ref KineticBlock.statement_block
15215  */
15216  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
15217  return statement_block;
15218  }
15219 
15220 
15221 
15222  /// \}
15223 
15224  /// \name Setters
15225  /// \{
15226 
15227 
15228  /**
15229  * \brief Set token for the current ast node
15230  */
15231  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
15232 
15233  /**
15234  * \brief Set symbol table for the current ast node
15235  *
15236  * Top level, block scoped nodes store symbol table in the ast node.
15237  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
15238  * for every node in the ast.
15239  *
15240  * \sa nmodl::visitor::SymtabVisitor
15241  */
15242  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
15243  symtab = newsymtab;
15244  }
15245 
15246 
15247 
15248  /**
15249  * \brief Setter for member variable \ref KineticBlock.name (rvalue reference)
15250  */
15251  void set_name(std::shared_ptr<Name>&& name);
15252 
15253  /**
15254  * \brief Setter for member variable \ref KineticBlock.name
15255  */
15256  void set_name(const std::shared_ptr<Name>& name);
15257 
15258 
15259  /**
15260  * \brief Setter for member variable \ref KineticBlock.solvefor (rvalue reference)
15261  */
15262  void set_solvefor(NameVector&& solvefor);
15263 
15264  /**
15265  * \brief Setter for member variable \ref KineticBlock.solvefor
15266  */
15267  void set_solvefor(const NameVector& solvefor);
15268 
15269 
15270  /**
15271  * \brief Setter for member variable \ref KineticBlock.statement_block (rvalue reference)
15272  */
15273  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
15274 
15275  /**
15276  * \brief Setter for member variable \ref KineticBlock.statement_block
15277  */
15278  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
15279 
15280 
15281  /// \}
15282 
15283  /// \name Visitor
15284  /// \{
15285 
15286  /**
15287  * \brief visit children i.e. member variables of current node using provided visitor
15288  *
15289  * Different nodes in the AST have different members (i.e. children). This method
15290  * recursively visits children using provided visitor.
15291  *
15292  * \param v Concrete visitor that will be used to recursively visit children
15293  *
15294  * \sa Ast::visit_children for example.
15295  */
15296  void visit_children(visitor::Visitor& v) override;
15297 
15298  /**
15299  * \brief visit children i.e. member variables of current node using provided visitor
15300  *
15301  * Different nodes in the AST have different members (i.e. children). This method
15302  * recursively visits children using provided visitor.
15303  *
15304  * \param v Concrete constant visitor that will be used to recursively visit children
15305  *
15306  * \sa Ast::visit_children for example.
15307  */
15308  void visit_children(visitor::ConstVisitor& v) const override;
15309 
15310  /**
15311  * \brief accept (or visit) the current AST node using provided visitor
15312  *
15313  * Instead of visiting children of AST node, like Ast::visit_children,
15314  * accept allows to visit the current node itself using provided concrete
15315  * visitor.
15316  *
15317  * \param v Concrete visitor that will be used to recursively visit node
15318  *
15319  * \sa Ast::accept for example.
15320  */
15321  void accept(visitor::Visitor& v) override;
15322 
15323  /**
15324  * \copydoc accept(visitor::Visitor&)
15325  */
15326  void accept(visitor::ConstVisitor& v) const override;
15327 
15328  /// \}
15329 
15330 
15331 
15332  private:
15333  /**
15334  * \brief Set this object as parent for all the children
15335  *
15336  * This should be called in every object (with children) constructor
15337  * to set parents. Since it is called only in the constructors it
15338  * should not be virtual to avoid ambiguities (issue #295).
15339  */
15340  void set_parent_in_children();
15341 };
15342 
15343 /** @} */ // end of ast_class
15344 
15345 
15346 } // namespace ast
15347 } // namespace nmodl
15348 #endif // !NMODL_AST_KINETIC_BLOCK_HPP
15349 #ifndef NMODL_AST_MATCH_BLOCK_HPP
15350 #define NMODL_AST_MATCH_BLOCK_HPP
15351 
15352 
15353 namespace nmodl {
15354 namespace ast {
15355 
15356 /**
15357  * @addtogroup ast_class
15358  * @ingroup ast
15359  * @{
15360  */
15361 
15362 /**
15363  * \brief TODO
15364  *
15365  *
15366 */
15367 class MatchBlock : public Block {
15368  private:
15369  /// Vector of match statements
15371  /// token with location information
15372  std::shared_ptr<ModToken> token;
15373  /// symbol table for a block
15374  symtab::SymbolTable* symtab = nullptr;
15375 
15376  public:
15377 
15378  /// \name Ctor & dtor
15379  /// \{
15380 
15381  explicit MatchBlock(MatchVector matchs);
15382  MatchBlock(const MatchBlock& obj);
15383 
15384 
15385  virtual ~MatchBlock() = default;
15386 
15387  /// \}
15388 
15389 
15390 
15391 
15392 
15393 
15394  /**
15395  * \brief Check if the ast node is an instance of ast::MatchBlock
15396  * \return true as object is of type ast::MatchBlock
15397  */
15398  bool is_match_block () const noexcept override {
15399  return true;
15400  }
15401 
15402  /**
15403  * \brief Return a copy of the current node
15404  *
15405  * Recursively make a new copy/clone of the current node including
15406  * all members and return a pointer to the node. This is used for
15407  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15408  * ast.
15409  *
15410  * @return pointer to the clone/copy of the current node
15411  */
15412  MatchBlock* clone() const override {
15413  return new MatchBlock(*this);
15414  }
15415 
15416  /// \name Getters
15417  /// \{
15418 
15419  /**
15420  * \brief Return type (ast::AstNodeType) of ast node
15421  *
15422  * Every node in the ast has a type defined in ast::AstNodeType and this
15423  * function is used to retrieve the same.
15424  *
15425  * \return ast node type i.e. ast::AstNodeType::MATCH_BLOCK
15426  *
15427  * \sa Ast::get_node_type_name
15428  */
15429  AstNodeType get_node_type() const noexcept override {
15430  return AstNodeType::MATCH_BLOCK;
15431  }
15432 
15433  /**
15434  * \brief Return type (ast::AstNodeType) of ast node as std::string
15435  *
15436  * Every node in the ast has a type defined in ast::AstNodeType.
15437  * This type name can be returned as a std::string for printing
15438  * node to text/json form.
15439  *
15440  * \return name of the node type as a string i.e. "MatchBlock"
15441  *
15442  * \sa Ast::get_node_name
15443  */
15444  std::string get_node_type_name() const noexcept override {
15445  return "MatchBlock";
15446  }
15447 
15448  /**
15449  * \brief Return NMODL statement of ast node as std::string
15450  *
15451  * Every node is related to a special statement in the NMODL. This
15452  * statement can be returned as a std::string for printing to
15453  * text/json form.
15454  *
15455  * \return name of the statement as a string i.e. "MATCH"
15456  *
15457  * \sa Ast::get_nmodl_name
15458  */
15459  std::string get_nmodl_name() const noexcept override {
15460  return "MATCH";
15461  }
15462 
15463  /**
15464  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15465  */
15466  std::shared_ptr<Ast> get_shared_ptr() override {
15467  return std::static_pointer_cast<MatchBlock>(shared_from_this());
15468  }
15469 
15470  /**
15471  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15472  */
15473  std::shared_ptr<const Ast> get_shared_ptr() const override {
15474  return std::static_pointer_cast<const MatchBlock>(shared_from_this());
15475  }
15476 
15477  /**
15478  * \brief Return associated token for the current ast node
15479  *
15480  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
15481  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
15482  * nullptr to store in the nmodl::symtab::SymbolTable.
15483  *
15484  * \return pointer to token if exist otherwise nullptr
15485  */
15486  const ModToken* get_token() const noexcept override {
15487  return token.get();
15488  }
15489 
15490  /**
15491  * \brief Return associated symbol table for the current ast node
15492  *
15493  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
15494  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
15495  * and it can be accessed using this method.
15496  *
15497  * \return pointer to the symbol table
15498  *
15499  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
15500  */
15502  return symtab;
15503  }
15504 
15505 
15506 
15507 
15508 
15509 
15510 
15511 
15512  /**
15513  * \brief Getter for member variable \ref MatchBlock.matchs
15514  */
15515  const MatchVector& get_matchs() const noexcept {
15516  return matchs;
15517  }
15518 
15519 
15520 
15521  /// \}
15522 
15523  /// \name Setters
15524  /// \{
15525 
15526 
15527  /**
15528  * \brief Set token for the current ast node
15529  */
15530  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
15531 
15532  /**
15533  * \brief Set symbol table for the current ast node
15534  *
15535  * Top level, block scoped nodes store symbol table in the ast node.
15536  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
15537  * for every node in the ast.
15538  *
15539  * \sa nmodl::visitor::SymtabVisitor
15540  */
15541  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
15542  symtab = newsymtab;
15543  }
15544 
15545 
15546 
15547  /**
15548  * \brief Setter for member variable \ref MatchBlock.matchs (rvalue reference)
15549  */
15550  void set_matchs(MatchVector&& matchs);
15551 
15552  /**
15553  * \brief Setter for member variable \ref MatchBlock.matchs
15554  */
15555  void set_matchs(const MatchVector& matchs);
15556 
15557 
15558  /// \}
15559 
15560  /// \name Visitor
15561  /// \{
15562 
15563  /**
15564  * \brief visit children i.e. member variables of current node using provided visitor
15565  *
15566  * Different nodes in the AST have different members (i.e. children). This method
15567  * recursively visits children using provided visitor.
15568  *
15569  * \param v Concrete visitor that will be used to recursively visit children
15570  *
15571  * \sa Ast::visit_children for example.
15572  */
15573  void visit_children(visitor::Visitor& v) override;
15574 
15575  /**
15576  * \brief visit children i.e. member variables of current node using provided visitor
15577  *
15578  * Different nodes in the AST have different members (i.e. children). This method
15579  * recursively visits children using provided visitor.
15580  *
15581  * \param v Concrete constant visitor that will be used to recursively visit children
15582  *
15583  * \sa Ast::visit_children for example.
15584  */
15585  void visit_children(visitor::ConstVisitor& v) const override;
15586 
15587  /**
15588  * \brief accept (or visit) the current AST node using provided visitor
15589  *
15590  * Instead of visiting children of AST node, like Ast::visit_children,
15591  * accept allows to visit the current node itself using provided concrete
15592  * visitor.
15593  *
15594  * \param v Concrete visitor that will be used to recursively visit node
15595  *
15596  * \sa Ast::accept for example.
15597  */
15598  void accept(visitor::Visitor& v) override;
15599 
15600  /**
15601  * \copydoc accept(visitor::Visitor&)
15602  */
15603  void accept(visitor::ConstVisitor& v) const override;
15604 
15605  /// \}
15606 
15607 
15608 
15609  private:
15610  /**
15611  * \brief Set this object as parent for all the children
15612  *
15613  * This should be called in every object (with children) constructor
15614  * to set parents. Since it is called only in the constructors it
15615  * should not be virtual to avoid ambiguities (issue #295).
15616  */
15617  void set_parent_in_children();
15618 };
15619 
15620 /** @} */ // end of ast_class
15621 
15622 
15623 } // namespace ast
15624 } // namespace nmodl
15625 #endif // !NMODL_AST_MATCH_BLOCK_HPP
15626 #ifndef NMODL_AST_UNIT_BLOCK_HPP
15627 #define NMODL_AST_UNIT_BLOCK_HPP
15628 
15629 
15630 namespace nmodl {
15631 namespace ast {
15632 
15633 /**
15634  * @addtogroup ast_class
15635  * @ingroup ast
15636  * @{
15637  */
15638 
15639 /**
15640  * \brief TODO
15641  *
15642  *
15643 */
15644 class UnitBlock : public Block {
15645  private:
15646  /// Vector of unit statements
15648  /// token with location information
15649  std::shared_ptr<ModToken> token;
15650  /// symbol table for a block
15651  symtab::SymbolTable* symtab = nullptr;
15652 
15653  public:
15654 
15655  /// \name Ctor & dtor
15656  /// \{
15657 
15658  explicit UnitBlock(ExpressionVector definitions);
15659  UnitBlock(const UnitBlock& obj);
15660 
15661 
15662  virtual ~UnitBlock() = default;
15663 
15664  /// \}
15665 
15666 
15667 
15668 
15669 
15670 
15671  /**
15672  * \brief Check if the ast node is an instance of ast::UnitBlock
15673  * \return true as object is of type ast::UnitBlock
15674  */
15675  bool is_unit_block () const noexcept override {
15676  return true;
15677  }
15678 
15679  /**
15680  * \brief Return a copy of the current node
15681  *
15682  * Recursively make a new copy/clone of the current node including
15683  * all members and return a pointer to the node. This is used for
15684  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15685  * ast.
15686  *
15687  * @return pointer to the clone/copy of the current node
15688  */
15689  UnitBlock* clone() const override {
15690  return new UnitBlock(*this);
15691  }
15692 
15693  /// \name Getters
15694  /// \{
15695 
15696  /**
15697  * \brief Return type (ast::AstNodeType) of ast node
15698  *
15699  * Every node in the ast has a type defined in ast::AstNodeType and this
15700  * function is used to retrieve the same.
15701  *
15702  * \return ast node type i.e. ast::AstNodeType::UNIT_BLOCK
15703  *
15704  * \sa Ast::get_node_type_name
15705  */
15706  AstNodeType get_node_type() const noexcept override {
15707  return AstNodeType::UNIT_BLOCK;
15708  }
15709 
15710  /**
15711  * \brief Return type (ast::AstNodeType) of ast node as std::string
15712  *
15713  * Every node in the ast has a type defined in ast::AstNodeType.
15714  * This type name can be returned as a std::string for printing
15715  * node to text/json form.
15716  *
15717  * \return name of the node type as a string i.e. "UnitBlock"
15718  *
15719  * \sa Ast::get_node_name
15720  */
15721  std::string get_node_type_name() const noexcept override {
15722  return "UnitBlock";
15723  }
15724 
15725  /**
15726  * \brief Return NMODL statement of ast node as std::string
15727  *
15728  * Every node is related to a special statement in the NMODL. This
15729  * statement can be returned as a std::string for printing to
15730  * text/json form.
15731  *
15732  * \return name of the statement as a string i.e. "UNITS "
15733  *
15734  * \sa Ast::get_nmodl_name
15735  */
15736  std::string get_nmodl_name() const noexcept override {
15737  return "UNITS ";
15738  }
15739 
15740  /**
15741  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15742  */
15743  std::shared_ptr<Ast> get_shared_ptr() override {
15744  return std::static_pointer_cast<UnitBlock>(shared_from_this());
15745  }
15746 
15747  /**
15748  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15749  */
15750  std::shared_ptr<const Ast> get_shared_ptr() const override {
15751  return std::static_pointer_cast<const UnitBlock>(shared_from_this());
15752  }
15753 
15754  /**
15755  * \brief Return associated token for the current ast node
15756  *
15757  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
15758  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
15759  * nullptr to store in the nmodl::symtab::SymbolTable.
15760  *
15761  * \return pointer to token if exist otherwise nullptr
15762  */
15763  const ModToken* get_token() const noexcept override {
15764  return token.get();
15765  }
15766 
15767  /**
15768  * \brief Return associated symbol table for the current ast node
15769  *
15770  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
15771  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
15772  * and it can be accessed using this method.
15773  *
15774  * \return pointer to the symbol table
15775  *
15776  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
15777  */
15779  return symtab;
15780  }
15781 
15782 
15783 
15784 
15785 
15786 
15787 
15788 
15789  /**
15790  * \brief Getter for member variable \ref UnitBlock.definitions
15791  */
15792  const ExpressionVector& get_definitions() const noexcept {
15793  return definitions;
15794  }
15795 
15796 
15797 
15798  /// \}
15799 
15800  /// \name Setters
15801  /// \{
15802 
15803 
15804  /**
15805  * \brief Set token for the current ast node
15806  */
15807  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
15808 
15809  /**
15810  * \brief Set symbol table for the current ast node
15811  *
15812  * Top level, block scoped nodes store symbol table in the ast node.
15813  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
15814  * for every node in the ast.
15815  *
15816  * \sa nmodl::visitor::SymtabVisitor
15817  */
15818  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
15819  symtab = newsymtab;
15820  }
15821 
15822 
15823 
15824  /**
15825  * \brief Setter for member variable \ref UnitBlock.definitions (rvalue reference)
15826  */
15827  void set_definitions(ExpressionVector&& definitions);
15828 
15829  /**
15830  * \brief Setter for member variable \ref UnitBlock.definitions
15831  */
15832  void set_definitions(const ExpressionVector& definitions);
15833 
15834 
15835  /// \}
15836 
15837  /// \name Visitor
15838  /// \{
15839 
15840  /**
15841  * \brief visit children i.e. member variables of current node using provided visitor
15842  *
15843  * Different nodes in the AST have different members (i.e. children). This method
15844  * recursively visits children using provided visitor.
15845  *
15846  * \param v Concrete visitor that will be used to recursively visit children
15847  *
15848  * \sa Ast::visit_children for example.
15849  */
15850  void visit_children(visitor::Visitor& v) override;
15851 
15852  /**
15853  * \brief visit children i.e. member variables of current node using provided visitor
15854  *
15855  * Different nodes in the AST have different members (i.e. children). This method
15856  * recursively visits children using provided visitor.
15857  *
15858  * \param v Concrete constant visitor that will be used to recursively visit children
15859  *
15860  * \sa Ast::visit_children for example.
15861  */
15862  void visit_children(visitor::ConstVisitor& v) const override;
15863 
15864  /**
15865  * \brief accept (or visit) the current AST node using provided visitor
15866  *
15867  * Instead of visiting children of AST node, like Ast::visit_children,
15868  * accept allows to visit the current node itself using provided concrete
15869  * visitor.
15870  *
15871  * \param v Concrete visitor that will be used to recursively visit node
15872  *
15873  * \sa Ast::accept for example.
15874  */
15875  void accept(visitor::Visitor& v) override;
15876 
15877  /**
15878  * \copydoc accept(visitor::Visitor&)
15879  */
15880  void accept(visitor::ConstVisitor& v) const override;
15881 
15882  /// \}
15883 
15884 
15885 
15886  private:
15887  /**
15888  * \brief Set this object as parent for all the children
15889  *
15890  * This should be called in every object (with children) constructor
15891  * to set parents. Since it is called only in the constructors it
15892  * should not be virtual to avoid ambiguities (issue #295).
15893  */
15894  void set_parent_in_children();
15895 };
15896 
15897 /** @} */ // end of ast_class
15898 
15899 
15900 } // namespace ast
15901 } // namespace nmodl
15902 #endif // !NMODL_AST_UNIT_BLOCK_HPP
15903 #ifndef NMODL_AST_CONSTANT_BLOCK_HPP
15904 #define NMODL_AST_CONSTANT_BLOCK_HPP
15905 
15906 
15907 namespace nmodl {
15908 namespace ast {
15909 
15910 /**
15911  * @addtogroup ast_class
15912  * @ingroup ast
15913  * @{
15914  */
15915 
15916 /**
15917  * \brief Represent `CONSTANT` block in the mod file
15918  *
15919  * Here is an example of `CONSTANT` block in mod file:
15920  *
15921  * \code{.mod}
15922  * CONSTANT {
15923  * q10 = 3
15924  *
15925  * cvm = 28.9 (mV)
15926  * ckm = 6.2 (mV)
15927  * ctm = 0.000505 (s)
15928  * }
15929  * \endcode
15930  *
15931 */
15932 class ConstantBlock : public Block {
15933  private:
15934  /// Vector of constant statements
15936  /// token with location information
15937  std::shared_ptr<ModToken> token;
15938  /// symbol table for a block
15939  symtab::SymbolTable* symtab = nullptr;
15940 
15941  public:
15942 
15943  /// \name Ctor & dtor
15944  /// \{
15945 
15946  explicit ConstantBlock(ConstantStatementVector statements);
15947  ConstantBlock(const ConstantBlock& obj);
15948 
15949 
15950  virtual ~ConstantBlock() = default;
15951 
15952  /// \}
15953 
15954 
15955 
15956 
15957 
15958 
15959  /**
15960  * \brief Check if the ast node is an instance of ast::ConstantBlock
15961  * \return true as object is of type ast::ConstantBlock
15962  */
15963  bool is_constant_block () const noexcept override {
15964  return true;
15965  }
15966 
15967  /**
15968  * \brief Return a copy of the current node
15969  *
15970  * Recursively make a new copy/clone of the current node including
15971  * all members and return a pointer to the node. This is used for
15972  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15973  * ast.
15974  *
15975  * @return pointer to the clone/copy of the current node
15976  */
15977  ConstantBlock* clone() const override {
15978  return new ConstantBlock(*this);
15979  }
15980 
15981  /// \name Getters
15982  /// \{
15983 
15984  /**
15985  * \brief Return type (ast::AstNodeType) of ast node
15986  *
15987  * Every node in the ast has a type defined in ast::AstNodeType and this
15988  * function is used to retrieve the same.
15989  *
15990  * \return ast node type i.e. ast::AstNodeType::CONSTANT_BLOCK
15991  *
15992  * \sa Ast::get_node_type_name
15993  */
15994  AstNodeType get_node_type() const noexcept override {
15996  }
15997 
15998  /**
15999  * \brief Return type (ast::AstNodeType) of ast node as std::string
16000  *
16001  * Every node in the ast has a type defined in ast::AstNodeType.
16002  * This type name can be returned as a std::string for printing
16003  * node to text/json form.
16004  *
16005  * \return name of the node type as a string i.e. "ConstantBlock"
16006  *
16007  * \sa Ast::get_node_name
16008  */
16009  std::string get_node_type_name() const noexcept override {
16010  return "ConstantBlock";
16011  }
16012 
16013  /**
16014  * \brief Return NMODL statement of ast node as std::string
16015  *
16016  * Every node is related to a special statement in the NMODL. This
16017  * statement can be returned as a std::string for printing to
16018  * text/json form.
16019  *
16020  * \return name of the statement as a string i.e. "CONSTANT "
16021  *
16022  * \sa Ast::get_nmodl_name
16023  */
16024  std::string get_nmodl_name() const noexcept override {
16025  return "CONSTANT ";
16026  }
16027 
16028  /**
16029  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16030  */
16031  std::shared_ptr<Ast> get_shared_ptr() override {
16032  return std::static_pointer_cast<ConstantBlock>(shared_from_this());
16033  }
16034 
16035  /**
16036  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16037  */
16038  std::shared_ptr<const Ast> get_shared_ptr() const override {
16039  return std::static_pointer_cast<const ConstantBlock>(shared_from_this());
16040  }
16041 
16042  /**
16043  * \brief Return associated token for the current ast node
16044  *
16045  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
16046  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
16047  * nullptr to store in the nmodl::symtab::SymbolTable.
16048  *
16049  * \return pointer to token if exist otherwise nullptr
16050  */
16051  const ModToken* get_token() const noexcept override {
16052  return token.get();
16053  }
16054 
16055  /**
16056  * \brief Return associated symbol table for the current ast node
16057  *
16058  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
16059  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
16060  * and it can be accessed using this method.
16061  *
16062  * \return pointer to the symbol table
16063  *
16064  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
16065  */
16067  return symtab;
16068  }
16069 
16070 
16071 
16072 
16073 
16074 
16075 
16076 
16077  /**
16078  * \brief Getter for member variable \ref ConstantBlock.statements
16079  */
16080  const ConstantStatementVector& get_statements() const noexcept {
16081  return statements;
16082  }
16083 
16084 
16085 
16086  /// \}
16087 
16088  /// \name Setters
16089  /// \{
16090 
16091 
16092  /**
16093  * \brief Set token for the current ast node
16094  */
16095  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
16096 
16097  /**
16098  * \brief Set symbol table for the current ast node
16099  *
16100  * Top level, block scoped nodes store symbol table in the ast node.
16101  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
16102  * for every node in the ast.
16103  *
16104  * \sa nmodl::visitor::SymtabVisitor
16105  */
16106  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
16107  symtab = newsymtab;
16108  }
16109 
16110 
16111 
16112  /**
16113  * \brief Setter for member variable \ref ConstantBlock.statements (rvalue reference)
16114  */
16115  void set_statements(ConstantStatementVector&& statements);
16116 
16117  /**
16118  * \brief Setter for member variable \ref ConstantBlock.statements
16119  */
16120  void set_statements(const ConstantStatementVector& statements);
16121 
16122 
16123  /// \}
16124 
16125  /// \name Visitor
16126  /// \{
16127 
16128  /**
16129  * \brief visit children i.e. member variables of current node using provided visitor
16130  *
16131  * Different nodes in the AST have different members (i.e. children). This method
16132  * recursively visits children using provided visitor.
16133  *
16134  * \param v Concrete visitor that will be used to recursively visit children
16135  *
16136  * \sa Ast::visit_children for example.
16137  */
16138  void visit_children(visitor::Visitor& v) override;
16139 
16140  /**
16141  * \brief visit children i.e. member variables of current node using provided visitor
16142  *
16143  * Different nodes in the AST have different members (i.e. children). This method
16144  * recursively visits children using provided visitor.
16145  *
16146  * \param v Concrete constant visitor that will be used to recursively visit children
16147  *
16148  * \sa Ast::visit_children for example.
16149  */
16150  void visit_children(visitor::ConstVisitor& v) const override;
16151 
16152  /**
16153  * \brief accept (or visit) the current AST node using provided visitor
16154  *
16155  * Instead of visiting children of AST node, like Ast::visit_children,
16156  * accept allows to visit the current node itself using provided concrete
16157  * visitor.
16158  *
16159  * \param v Concrete visitor that will be used to recursively visit node
16160  *
16161  * \sa Ast::accept for example.
16162  */
16163  void accept(visitor::Visitor& v) override;
16164 
16165  /**
16166  * \copydoc accept(visitor::Visitor&)
16167  */
16168  void accept(visitor::ConstVisitor& v) const override;
16169 
16170  /// \}
16171 
16172 
16173 
16174  private:
16175  /**
16176  * \brief Set this object as parent for all the children
16177  *
16178  * This should be called in every object (with children) constructor
16179  * to set parents. Since it is called only in the constructors it
16180  * should not be virtual to avoid ambiguities (issue #295).
16181  */
16182  void set_parent_in_children();
16183 };
16184 
16185 /** @} */ // end of ast_class
16186 
16187 
16188 } // namespace ast
16189 } // namespace nmodl
16190 #endif // !NMODL_AST_CONSTANT_BLOCK_HPP
16191 #ifndef NMODL_AST_NEURON_BLOCK_HPP
16192 #define NMODL_AST_NEURON_BLOCK_HPP
16193 
16194 
16195 namespace nmodl {
16196 namespace ast {
16197 
16198 /**
16199  * @addtogroup ast_class
16200  * @ingroup ast
16201  * @{
16202  */
16203 
16204 /**
16205  * \brief Represent `NEURON` block in the mod file
16206  *
16207  * The keyword `NEURON` introduces a special block which contains statements
16208  * that tell NMODL how to organize the variables for access at the NEURON user
16209  * level. Here is an example of `NEURON` block from `HH` channel:
16210  *
16211  * \code{.mod}
16212  * NEURON {
16213  * SUFFIX hh
16214  * USEION na READ ena WRITE ina
16215  * USEION k READ ek WRITE ik
16216  * NONSPECIFIC_CURRENT il
16217  * RANGE gnabar, gkbar, gl, el, gna, gk
16218  * RANGE minf, hinf, ninf, mtau, htau, ntau
16219  * THREADSAFE
16220  * }
16221  * \endcode
16222  *
16223 */
16224 class NeuronBlock : public Block {
16225  private:
16226  /// Block with statements vector
16227  std::shared_ptr<StatementBlock> statement_block;
16228  /// token with location information
16229  std::shared_ptr<ModToken> token;
16230  /// symbol table for a block
16231  symtab::SymbolTable* symtab = nullptr;
16232 
16233  public:
16234 
16235  /// \name Ctor & dtor
16236  /// \{
16237 
16238  explicit NeuronBlock(StatementBlock* statement_block);
16239  explicit NeuronBlock(const std::shared_ptr<StatementBlock>& statement_block);
16240  NeuronBlock(const NeuronBlock& obj);
16241 
16242 
16243  virtual ~NeuronBlock() = default;
16244 
16245  /// \}
16246 
16247 
16248 
16249 
16250 
16251 
16252  /**
16253  * \brief Check if the ast node is an instance of ast::NeuronBlock
16254  * \return true as object is of type ast::NeuronBlock
16255  */
16256  bool is_neuron_block () const noexcept override {
16257  return true;
16258  }
16259 
16260  /**
16261  * \brief Return a copy of the current node
16262  *
16263  * Recursively make a new copy/clone of the current node including
16264  * all members and return a pointer to the node. This is used for
16265  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16266  * ast.
16267  *
16268  * @return pointer to the clone/copy of the current node
16269  */
16270  NeuronBlock* clone() const override {
16271  return new NeuronBlock(*this);
16272  }
16273 
16274  /// \name Getters
16275  /// \{
16276 
16277  /**
16278  * \brief Return type (ast::AstNodeType) of ast node
16279  *
16280  * Every node in the ast has a type defined in ast::AstNodeType and this
16281  * function is used to retrieve the same.
16282  *
16283  * \return ast node type i.e. ast::AstNodeType::NEURON_BLOCK
16284  *
16285  * \sa Ast::get_node_type_name
16286  */
16287  AstNodeType get_node_type() const noexcept override {
16289  }
16290 
16291  /**
16292  * \brief Return type (ast::AstNodeType) of ast node as std::string
16293  *
16294  * Every node in the ast has a type defined in ast::AstNodeType.
16295  * This type name can be returned as a std::string for printing
16296  * node to text/json form.
16297  *
16298  * \return name of the node type as a string i.e. "NeuronBlock"
16299  *
16300  * \sa Ast::get_node_name
16301  */
16302  std::string get_node_type_name() const noexcept override {
16303  return "NeuronBlock";
16304  }
16305 
16306  /**
16307  * \brief Return NMODL statement of ast node as std::string
16308  *
16309  * Every node is related to a special statement in the NMODL. This
16310  * statement can be returned as a std::string for printing to
16311  * text/json form.
16312  *
16313  * \return name of the statement as a string i.e. "NEURON "
16314  *
16315  * \sa Ast::get_nmodl_name
16316  */
16317  std::string get_nmodl_name() const noexcept override {
16318  return "NEURON ";
16319  }
16320 
16321  /**
16322  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16323  */
16324  std::shared_ptr<Ast> get_shared_ptr() override {
16325  return std::static_pointer_cast<NeuronBlock>(shared_from_this());
16326  }
16327 
16328  /**
16329  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16330  */
16331  std::shared_ptr<const Ast> get_shared_ptr() const override {
16332  return std::static_pointer_cast<const NeuronBlock>(shared_from_this());
16333  }
16334 
16335  /**
16336  * \brief Return associated token for the current ast node
16337  *
16338  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
16339  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
16340  * nullptr to store in the nmodl::symtab::SymbolTable.
16341  *
16342  * \return pointer to token if exist otherwise nullptr
16343  */
16344  const ModToken* get_token() const noexcept override {
16345  return token.get();
16346  }
16347 
16348  /**
16349  * \brief Return associated symbol table for the current ast node
16350  *
16351  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
16352  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
16353  * and it can be accessed using this method.
16354  *
16355  * \return pointer to the symbol table
16356  *
16357  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
16358  */
16360  return symtab;
16361  }
16362 
16363 
16364 
16365 
16366 
16367 
16368 
16369 
16370  /**
16371  * \brief Getter for member variable \ref NeuronBlock.statement_block
16372  */
16373  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
16374  return statement_block;
16375  }
16376 
16377 
16378 
16379  /// \}
16380 
16381  /// \name Setters
16382  /// \{
16383 
16384 
16385  /**
16386  * \brief Set token for the current ast node
16387  */
16388  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
16389 
16390  /**
16391  * \brief Set symbol table for the current ast node
16392  *
16393  * Top level, block scoped nodes store symbol table in the ast node.
16394  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
16395  * for every node in the ast.
16396  *
16397  * \sa nmodl::visitor::SymtabVisitor
16398  */
16399  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
16400  symtab = newsymtab;
16401  }
16402 
16403 
16404 
16405  /**
16406  * \brief Setter for member variable \ref NeuronBlock.statement_block (rvalue reference)
16407  */
16408  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
16409 
16410  /**
16411  * \brief Setter for member variable \ref NeuronBlock.statement_block
16412  */
16413  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
16414 
16415 
16416  /// \}
16417 
16418  /// \name Visitor
16419  /// \{
16420 
16421  /**
16422  * \brief visit children i.e. member variables of current node using provided visitor
16423  *
16424  * Different nodes in the AST have different members (i.e. children). This method
16425  * recursively visits children using provided visitor.
16426  *
16427  * \param v Concrete visitor that will be used to recursively visit children
16428  *
16429  * \sa Ast::visit_children for example.
16430  */
16431  void visit_children(visitor::Visitor& v) override;
16432 
16433  /**
16434  * \brief visit children i.e. member variables of current node using provided visitor
16435  *
16436  * Different nodes in the AST have different members (i.e. children). This method
16437  * recursively visits children using provided visitor.
16438  *
16439  * \param v Concrete constant visitor that will be used to recursively visit children
16440  *
16441  * \sa Ast::visit_children for example.
16442  */
16443  void visit_children(visitor::ConstVisitor& v) const override;
16444 
16445  /**
16446  * \brief accept (or visit) the current AST node using provided visitor
16447  *
16448  * Instead of visiting children of AST node, like Ast::visit_children,
16449  * accept allows to visit the current node itself using provided concrete
16450  * visitor.
16451  *
16452  * \param v Concrete visitor that will be used to recursively visit node
16453  *
16454  * \sa Ast::accept for example.
16455  */
16456  void accept(visitor::Visitor& v) override;
16457 
16458  /**
16459  * \copydoc accept(visitor::Visitor&)
16460  */
16461  void accept(visitor::ConstVisitor& v) const override;
16462 
16463  /// \}
16464 
16465 
16466 
16467  private:
16468  /**
16469  * \brief Set this object as parent for all the children
16470  *
16471  * This should be called in every object (with children) constructor
16472  * to set parents. Since it is called only in the constructors it
16473  * should not be virtual to avoid ambiguities (issue #295).
16474  */
16475  void set_parent_in_children();
16476 };
16477 
16478 /** @} */ // end of ast_class
16479 
16480 
16481 } // namespace ast
16482 } // namespace nmodl
16483 #endif // !NMODL_AST_NEURON_BLOCK_HPP
16484 #ifndef NMODL_AST_UNIT_HPP
16485 #define NMODL_AST_UNIT_HPP
16486 
16487 
16488 namespace nmodl {
16489 namespace ast {
16490 
16491 /**
16492  * @addtogroup ast_class
16493  * @ingroup ast
16494  * @{
16495  */
16496 
16497 /**
16498  * \brief TODO
16499  *
16500  *
16501 */
16502 class Unit : public Expression {
16503  private:
16504  /// TODO
16505  std::shared_ptr<String> name;
16506  /// token with location information
16507  std::shared_ptr<ModToken> token;
16508 
16509  public:
16510 
16511  /// \name Ctor & dtor
16512  /// \{
16513 
16514  explicit Unit(String* name);
16515  explicit Unit(const std::shared_ptr<String>& name);
16516  Unit(const Unit& obj);
16517 
16518 
16519  virtual ~Unit() = default;
16520 
16521  /// \}
16522 
16523 
16524 
16525 
16526 
16527 
16528  /**
16529  * \brief Check if the ast node is an instance of ast::Unit
16530  * \return true as object is of type ast::Unit
16531  */
16532  bool is_unit () const noexcept override {
16533  return true;
16534  }
16535 
16536  /**
16537  * \brief Return a copy of the current node
16538  *
16539  * Recursively make a new copy/clone of the current node including
16540  * all members and return a pointer to the node. This is used for
16541  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16542  * ast.
16543  *
16544  * @return pointer to the clone/copy of the current node
16545  */
16546  Unit* clone() const override {
16547  return new Unit(*this);
16548  }
16549 
16550  /// \name Getters
16551  /// \{
16552 
16553  /**
16554  * \brief Return type (ast::AstNodeType) of ast node
16555  *
16556  * Every node in the ast has a type defined in ast::AstNodeType and this
16557  * function is used to retrieve the same.
16558  *
16559  * \return ast node type i.e. ast::AstNodeType::UNIT
16560  *
16561  * \sa Ast::get_node_type_name
16562  */
16563  AstNodeType get_node_type() const noexcept override {
16564  return AstNodeType::UNIT;
16565  }
16566 
16567  /**
16568  * \brief Return type (ast::AstNodeType) of ast node as std::string
16569  *
16570  * Every node in the ast has a type defined in ast::AstNodeType.
16571  * This type name can be returned as a std::string for printing
16572  * node to text/json form.
16573  *
16574  * \return name of the node type as a string i.e. "Unit"
16575  *
16576  * \sa Ast::get_node_name
16577  */
16578  std::string get_node_type_name() const noexcept override {
16579  return "Unit";
16580  }
16581 
16582 
16583  /**
16584  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16585  */
16586  std::shared_ptr<Ast> get_shared_ptr() override {
16587  return std::static_pointer_cast<Unit>(shared_from_this());
16588  }
16589 
16590  /**
16591  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16592  */
16593  std::shared_ptr<const Ast> get_shared_ptr() const override {
16594  return std::static_pointer_cast<const Unit>(shared_from_this());
16595  }
16596 
16597  /**
16598  * \brief Return associated token for the current ast node
16599  *
16600  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
16601  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
16602  * nullptr to store in the nmodl::symtab::SymbolTable.
16603  *
16604  * \return pointer to token if exist otherwise nullptr
16605  */
16606  const ModToken* get_token() const noexcept override {
16607  return token.get();
16608  }
16609 
16610 
16611 
16612 
16613 
16614 
16615 /**
16616  * \brief Return name of the node
16617  *
16618  * Some ast nodes have a member marked designated as node name. For example,
16619  * in case of this ast::String has name designated as a
16620  * node name.
16621  *
16622  * @return name of the node as std::string
16623  *
16624  * \sa Ast::get_node_type_name
16625  */
16626 std::string get_node_name() const override;
16627 
16628 
16629  /**
16630  * \brief Getter for member variable \ref Unit.name
16631  */
16632  const std::shared_ptr<String>& get_name() const noexcept {
16633  return name;
16634  }
16635 
16636 
16637 
16638  /// \}
16639 
16640  /// \name Setters
16641  /// \{
16642 
16643 
16644  /**
16645  * \brief Set token for the current ast node
16646  */
16647  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
16648 
16649 
16650 
16651 
16652  /**
16653  * \brief Setter for member variable \ref Unit.name (rvalue reference)
16654  */
16655  void set_name(std::shared_ptr<String>&& name);
16656 
16657  /**
16658  * \brief Setter for member variable \ref Unit.name
16659  */
16660  void set_name(const std::shared_ptr<String>& name);
16661 
16662 
16663  /// \}
16664 
16665  /// \name Visitor
16666  /// \{
16667 
16668  /**
16669  * \brief visit children i.e. member variables of current node using provided visitor
16670  *
16671  * Different nodes in the AST have different members (i.e. children). This method
16672  * recursively visits children using provided visitor.
16673  *
16674  * \param v Concrete visitor that will be used to recursively visit children
16675  *
16676  * \sa Ast::visit_children for example.
16677  */
16678  void visit_children(visitor::Visitor& v) override;
16679 
16680  /**
16681  * \brief visit children i.e. member variables of current node using provided visitor
16682  *
16683  * Different nodes in the AST have different members (i.e. children). This method
16684  * recursively visits children using provided visitor.
16685  *
16686  * \param v Concrete constant visitor that will be used to recursively visit children
16687  *
16688  * \sa Ast::visit_children for example.
16689  */
16690  void visit_children(visitor::ConstVisitor& v) const override;
16691 
16692  /**
16693  * \brief accept (or visit) the current AST node using provided visitor
16694  *
16695  * Instead of visiting children of AST node, like Ast::visit_children,
16696  * accept allows to visit the current node itself using provided concrete
16697  * visitor.
16698  *
16699  * \param v Concrete visitor that will be used to recursively visit node
16700  *
16701  * \sa Ast::accept for example.
16702  */
16703  void accept(visitor::Visitor& v) override;
16704 
16705  /**
16706  * \copydoc accept(visitor::Visitor&)
16707  */
16708  void accept(visitor::ConstVisitor& v) const override;
16709 
16710  /// \}
16711 
16712 
16713 
16714  private:
16715  /**
16716  * \brief Set this object as parent for all the children
16717  *
16718  * This should be called in every object (with children) constructor
16719  * to set parents. Since it is called only in the constructors it
16720  * should not be virtual to avoid ambiguities (issue #295).
16721  */
16722  void set_parent_in_children();
16723 };
16724 
16725 /** @} */ // end of ast_class
16726 
16727 
16728 } // namespace ast
16729 } // namespace nmodl
16730 #endif // !NMODL_AST_UNIT_HPP
16731 #ifndef NMODL_AST_DOUBLE_UNIT_HPP
16732 #define NMODL_AST_DOUBLE_UNIT_HPP
16733 
16734 
16735 namespace nmodl {
16736 namespace ast {
16737 
16738 /**
16739  * @addtogroup ast_class
16740  * @ingroup ast
16741  * @{
16742  */
16743 
16744 /**
16745  * \brief TODO
16746  *
16747  *
16748 */
16749 class DoubleUnit : public Expression {
16750  private:
16751  /// TODO
16752  std::shared_ptr<Double> value;
16753  /// TODO
16754  std::shared_ptr<Unit> unit;
16755  /// token with location information
16756  std::shared_ptr<ModToken> token;
16757 
16758  public:
16759 
16760  /// \name Ctor & dtor
16761  /// \{
16762 
16763  explicit DoubleUnit(Double* value, Unit* unit);
16764  explicit DoubleUnit(const std::shared_ptr<Double>& value, const std::shared_ptr<Unit>& unit);
16765  DoubleUnit(const DoubleUnit& obj);
16766 
16767 
16768  virtual ~DoubleUnit() = default;
16769 
16770  /// \}
16771 
16772 
16773 
16774 
16775 
16776 
16777  /**
16778  * \brief Check if the ast node is an instance of ast::DoubleUnit
16779  * \return true as object is of type ast::DoubleUnit
16780  */
16781  bool is_double_unit () const noexcept override {
16782  return true;
16783  }
16784 
16785  /**
16786  * \brief Return a copy of the current node
16787  *
16788  * Recursively make a new copy/clone of the current node including
16789  * all members and return a pointer to the node. This is used for
16790  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16791  * ast.
16792  *
16793  * @return pointer to the clone/copy of the current node
16794  */
16795  DoubleUnit* clone() const override {
16796  return new DoubleUnit(*this);
16797  }
16798 
16799  /// \name Getters
16800  /// \{
16801 
16802  /**
16803  * \brief Return type (ast::AstNodeType) of ast node
16804  *
16805  * Every node in the ast has a type defined in ast::AstNodeType and this
16806  * function is used to retrieve the same.
16807  *
16808  * \return ast node type i.e. ast::AstNodeType::DOUBLE_UNIT
16809  *
16810  * \sa Ast::get_node_type_name
16811  */
16812  AstNodeType get_node_type() const noexcept override {
16813  return AstNodeType::DOUBLE_UNIT;
16814  }
16815 
16816  /**
16817  * \brief Return type (ast::AstNodeType) of ast node as std::string
16818  *
16819  * Every node in the ast has a type defined in ast::AstNodeType.
16820  * This type name can be returned as a std::string for printing
16821  * node to text/json form.
16822  *
16823  * \return name of the node type as a string i.e. "DoubleUnit"
16824  *
16825  * \sa Ast::get_node_name
16826  */
16827  std::string get_node_type_name() const noexcept override {
16828  return "DoubleUnit";
16829  }
16830 
16831 
16832  /**
16833  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16834  */
16835  std::shared_ptr<Ast> get_shared_ptr() override {
16836  return std::static_pointer_cast<DoubleUnit>(shared_from_this());
16837  }
16838 
16839  /**
16840  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16841  */
16842  std::shared_ptr<const Ast> get_shared_ptr() const override {
16843  return std::static_pointer_cast<const DoubleUnit>(shared_from_this());
16844  }
16845 
16846  /**
16847  * \brief Return associated token for the current ast node
16848  *
16849  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
16850  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
16851  * nullptr to store in the nmodl::symtab::SymbolTable.
16852  *
16853  * \return pointer to token if exist otherwise nullptr
16854  */
16855  const ModToken* get_token() const noexcept override {
16856  return token.get();
16857  }
16858 
16859 
16860 
16861 
16862 
16863 
16864 
16865 
16866  /**
16867  * \brief Getter for member variable \ref DoubleUnit.value
16868  */
16869  const std::shared_ptr<Double>& get_value() const noexcept {
16870  return value;
16871  }
16872 
16873 
16874 
16875 
16876 
16877 
16878 
16879  /**
16880  * \brief Getter for member variable \ref DoubleUnit.unit
16881  */
16882  const std::shared_ptr<Unit>& get_unit() const noexcept {
16883  return unit;
16884  }
16885 
16886 
16887 
16888  /// \}
16889 
16890  /// \name Setters
16891  /// \{
16892 
16893 
16894  /**
16895  * \brief Set token for the current ast node
16896  */
16897  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
16898 
16899 
16900 
16901 
16902  /**
16903  * \brief Setter for member variable \ref DoubleUnit.value (rvalue reference)
16904  */
16905  void set_value(std::shared_ptr<Double>&& value);
16906 
16907  /**
16908  * \brief Setter for member variable \ref DoubleUnit.value
16909  */
16910  void set_value(const std::shared_ptr<Double>& value);
16911 
16912 
16913  /**
16914  * \brief Setter for member variable \ref DoubleUnit.unit (rvalue reference)
16915  */
16916  void set_unit(std::shared_ptr<Unit>&& unit);
16917 
16918  /**
16919  * \brief Setter for member variable \ref DoubleUnit.unit
16920  */
16921  void set_unit(const std::shared_ptr<Unit>& unit);
16922 
16923 
16924  /// \}
16925 
16926  /// \name Visitor
16927  /// \{
16928 
16929  /**
16930  * \brief visit children i.e. member variables of current node using provided visitor
16931  *
16932  * Different nodes in the AST have different members (i.e. children). This method
16933  * recursively visits children using provided visitor.
16934  *
16935  * \param v Concrete visitor that will be used to recursively visit children
16936  *
16937  * \sa Ast::visit_children for example.
16938  */
16939  void visit_children(visitor::Visitor& v) override;
16940 
16941  /**
16942  * \brief visit children i.e. member variables of current node using provided visitor
16943  *
16944  * Different nodes in the AST have different members (i.e. children). This method
16945  * recursively visits children using provided visitor.
16946  *
16947  * \param v Concrete constant visitor that will be used to recursively visit children
16948  *
16949  * \sa Ast::visit_children for example.
16950  */
16951  void visit_children(visitor::ConstVisitor& v) const override;
16952 
16953  /**
16954  * \brief accept (or visit) the current AST node using provided visitor
16955  *
16956  * Instead of visiting children of AST node, like Ast::visit_children,
16957  * accept allows to visit the current node itself using provided concrete
16958  * visitor.
16959  *
16960  * \param v Concrete visitor that will be used to recursively visit node
16961  *
16962  * \sa Ast::accept for example.
16963  */
16964  void accept(visitor::Visitor& v) override;
16965 
16966  /**
16967  * \copydoc accept(visitor::Visitor&)
16968  */
16969  void accept(visitor::ConstVisitor& v) const override;
16970 
16971  /// \}
16972 
16973 
16974 
16975  private:
16976  /**
16977  * \brief Set this object as parent for all the children
16978  *
16979  * This should be called in every object (with children) constructor
16980  * to set parents. Since it is called only in the constructors it
16981  * should not be virtual to avoid ambiguities (issue #295).
16982  */
16983  void set_parent_in_children();
16984 };
16985 
16986 /** @} */ // end of ast_class
16987 
16988 
16989 } // namespace ast
16990 } // namespace nmodl
16991 #endif // !NMODL_AST_DOUBLE_UNIT_HPP
16992 #ifndef NMODL_AST_LOCAL_VAR_HPP
16993 #define NMODL_AST_LOCAL_VAR_HPP
16994 
16995 
16996 namespace nmodl {
16997 namespace ast {
16998 
16999 /**
17000  * @addtogroup ast_class
17001  * @ingroup ast
17002  * @{
17003  */
17004 
17005 /**
17006  * \brief TODO
17007  *
17008  *
17009 */
17010 class LocalVar : public Expression {
17011  private:
17012  /// TODO
17013  std::shared_ptr<Identifier> name;
17014  /// token with location information
17015  std::shared_ptr<ModToken> token;
17016 
17017  public:
17018 
17019  /// \name Ctor & dtor
17020  /// \{
17021 
17022  explicit LocalVar(Identifier* name);
17023  explicit LocalVar(const std::shared_ptr<Identifier>& name);
17024  LocalVar(const LocalVar& obj);
17025 
17026 
17027  virtual ~LocalVar() = default;
17028 
17029  /// \}
17030 
17031 
17032 
17033 
17034 
17035 
17036  /**
17037  * \brief Check if the ast node is an instance of ast::LocalVar
17038  * \return true as object is of type ast::LocalVar
17039  */
17040  bool is_local_var () const noexcept override {
17041  return true;
17042  }
17043 
17044  /**
17045  * \brief Return a copy of the current node
17046  *
17047  * Recursively make a new copy/clone of the current node including
17048  * all members and return a pointer to the node. This is used for
17049  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17050  * ast.
17051  *
17052  * @return pointer to the clone/copy of the current node
17053  */
17054  LocalVar* clone() const override {
17055  return new LocalVar(*this);
17056  }
17057 
17058  /// \name Getters
17059  /// \{
17060 
17061  /**
17062  * \brief Return type (ast::AstNodeType) of ast node
17063  *
17064  * Every node in the ast has a type defined in ast::AstNodeType and this
17065  * function is used to retrieve the same.
17066  *
17067  * \return ast node type i.e. ast::AstNodeType::LOCAL_VAR
17068  *
17069  * \sa Ast::get_node_type_name
17070  */
17071  AstNodeType get_node_type() const noexcept override {
17072  return AstNodeType::LOCAL_VAR;
17073  }
17074 
17075  /**
17076  * \brief Return type (ast::AstNodeType) of ast node as std::string
17077  *
17078  * Every node in the ast has a type defined in ast::AstNodeType.
17079  * This type name can be returned as a std::string for printing
17080  * node to text/json form.
17081  *
17082  * \return name of the node type as a string i.e. "LocalVar"
17083  *
17084  * \sa Ast::get_node_name
17085  */
17086  std::string get_node_type_name() const noexcept override {
17087  return "LocalVar";
17088  }
17089 
17090 
17091  /**
17092  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17093  */
17094  std::shared_ptr<Ast> get_shared_ptr() override {
17095  return std::static_pointer_cast<LocalVar>(shared_from_this());
17096  }
17097 
17098  /**
17099  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17100  */
17101  std::shared_ptr<const Ast> get_shared_ptr() const override {
17102  return std::static_pointer_cast<const LocalVar>(shared_from_this());
17103  }
17104 
17105  /**
17106  * \brief Return associated token for the current ast node
17107  *
17108  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
17109  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
17110  * nullptr to store in the nmodl::symtab::SymbolTable.
17111  *
17112  * \return pointer to token if exist otherwise nullptr
17113  */
17114  const ModToken* get_token() const noexcept override {
17115  return token.get();
17116  }
17117 
17118 
17119 
17120 
17121 
17122 
17123 /**
17124  * \brief Return name of the node
17125  *
17126  * Some ast nodes have a member marked designated as node name. For example,
17127  * in case of this ast::Identifier has name designated as a
17128  * node name.
17129  *
17130  * @return name of the node as std::string
17131  *
17132  * \sa Ast::get_node_type_name
17133  */
17134 std::string get_node_name() const override;
17135 
17136 
17137  /**
17138  * \brief Getter for member variable \ref LocalVar.name
17139  */
17140  const std::shared_ptr<Identifier>& get_name() const noexcept {
17141  return name;
17142  }
17143 
17144 
17145 
17146  /// \}
17147 
17148  /// \name Setters
17149  /// \{
17150 
17151 
17152  /**
17153  * \brief Set token for the current ast node
17154  */
17155  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
17156 
17157 
17158 
17159 
17160  /**
17161  * \brief Setter for member variable \ref LocalVar.name (rvalue reference)
17162  */
17163  void set_name(std::shared_ptr<Identifier>&& name);
17164 
17165  /**
17166  * \brief Setter for member variable \ref LocalVar.name
17167  */
17168  void set_name(const std::shared_ptr<Identifier>& name);
17169 
17170 
17171  /// \}
17172 
17173  /// \name Visitor
17174  /// \{
17175 
17176  /**
17177  * \brief visit children i.e. member variables of current node using provided visitor
17178  *
17179  * Different nodes in the AST have different members (i.e. children). This method
17180  * recursively visits children using provided visitor.
17181  *
17182  * \param v Concrete visitor that will be used to recursively visit children
17183  *
17184  * \sa Ast::visit_children for example.
17185  */
17186  void visit_children(visitor::Visitor& v) override;
17187 
17188  /**
17189  * \brief visit children i.e. member variables of current node using provided visitor
17190  *
17191  * Different nodes in the AST have different members (i.e. children). This method
17192  * recursively visits children using provided visitor.
17193  *
17194  * \param v Concrete constant visitor that will be used to recursively visit children
17195  *
17196  * \sa Ast::visit_children for example.
17197  */
17198  void visit_children(visitor::ConstVisitor& v) const override;
17199 
17200  /**
17201  * \brief accept (or visit) the current AST node using provided visitor
17202  *
17203  * Instead of visiting children of AST node, like Ast::visit_children,
17204  * accept allows to visit the current node itself using provided concrete
17205  * visitor.
17206  *
17207  * \param v Concrete visitor that will be used to recursively visit node
17208  *
17209  * \sa Ast::accept for example.
17210  */
17211  void accept(visitor::Visitor& v) override;
17212 
17213  /**
17214  * \copydoc accept(visitor::Visitor&)
17215  */
17216  void accept(visitor::ConstVisitor& v) const override;
17217 
17218  /// \}
17219 
17220 
17221 
17222  private:
17223  /**
17224  * \brief Set this object as parent for all the children
17225  *
17226  * This should be called in every object (with children) constructor
17227  * to set parents. Since it is called only in the constructors it
17228  * should not be virtual to avoid ambiguities (issue #295).
17229  */
17230  void set_parent_in_children();
17231 };
17232 
17233 /** @} */ // end of ast_class
17234 
17235 
17236 } // namespace ast
17237 } // namespace nmodl
17238 #endif // !NMODL_AST_LOCAL_VAR_HPP
17239 #ifndef NMODL_AST_LIMITS_HPP
17240 #define NMODL_AST_LIMITS_HPP
17241 
17242 
17243 namespace nmodl {
17244 namespace ast {
17245 
17246 /**
17247  * @addtogroup ast_class
17248  * @ingroup ast
17249  * @{
17250  */
17251 
17252 /**
17253  * \brief TODO
17254  *
17255  *
17256 */
17257 class Limits : public Expression {
17258  private:
17259  /// TODO
17260  std::shared_ptr<Double> min;
17261  /// TODO
17262  std::shared_ptr<Double> max;
17263  /// token with location information
17264  std::shared_ptr<ModToken> token;
17265 
17266  public:
17267 
17268  /// \name Ctor & dtor
17269  /// \{
17270 
17271  explicit Limits(Double* min, Double* max);
17272  explicit Limits(const std::shared_ptr<Double>& min, const std::shared_ptr<Double>& max);
17273  Limits(const Limits& obj);
17274 
17275 
17276  virtual ~Limits() = default;
17277 
17278  /// \}
17279 
17280 
17281 
17282 
17283 
17284 
17285  /**
17286  * \brief Check if the ast node is an instance of ast::Limits
17287  * \return true as object is of type ast::Limits
17288  */
17289  bool is_limits () const noexcept override {
17290  return true;
17291  }
17292 
17293  /**
17294  * \brief Return a copy of the current node
17295  *
17296  * Recursively make a new copy/clone of the current node including
17297  * all members and return a pointer to the node. This is used for
17298  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17299  * ast.
17300  *
17301  * @return pointer to the clone/copy of the current node
17302  */
17303  Limits* clone() const override {
17304  return new Limits(*this);
17305  }
17306 
17307  /// \name Getters
17308  /// \{
17309 
17310  /**
17311  * \brief Return type (ast::AstNodeType) of ast node
17312  *
17313  * Every node in the ast has a type defined in ast::AstNodeType and this
17314  * function is used to retrieve the same.
17315  *
17316  * \return ast node type i.e. ast::AstNodeType::LIMITS
17317  *
17318  * \sa Ast::get_node_type_name
17319  */
17320  AstNodeType get_node_type() const noexcept override {
17321  return AstNodeType::LIMITS;
17322  }
17323 
17324  /**
17325  * \brief Return type (ast::AstNodeType) of ast node as std::string
17326  *
17327  * Every node in the ast has a type defined in ast::AstNodeType.
17328  * This type name can be returned as a std::string for printing
17329  * node to text/json form.
17330  *
17331  * \return name of the node type as a string i.e. "Limits"
17332  *
17333  * \sa Ast::get_node_name
17334  */
17335  std::string get_node_type_name() const noexcept override {
17336  return "Limits";
17337  }
17338 
17339 
17340  /**
17341  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17342  */
17343  std::shared_ptr<Ast> get_shared_ptr() override {
17344  return std::static_pointer_cast<Limits>(shared_from_this());
17345  }
17346 
17347  /**
17348  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17349  */
17350  std::shared_ptr<const Ast> get_shared_ptr() const override {
17351  return std::static_pointer_cast<const Limits>(shared_from_this());
17352  }
17353 
17354  /**
17355  * \brief Return associated token for the current ast node
17356  *
17357  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
17358  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
17359  * nullptr to store in the nmodl::symtab::SymbolTable.
17360  *
17361  * \return pointer to token if exist otherwise nullptr
17362  */
17363  const ModToken* get_token() const noexcept override {
17364  return token.get();
17365  }
17366 
17367 
17368 
17369 
17370 
17371 
17372 
17373 
17374  /**
17375  * \brief Getter for member variable \ref Limits.min
17376  */
17377  const std::shared_ptr<Double>& get_min() const noexcept {
17378  return min;
17379  }
17380 
17381 
17382 
17383 
17384 
17385 
17386 
17387  /**
17388  * \brief Getter for member variable \ref Limits.max
17389  */
17390  const std::shared_ptr<Double>& get_max() const noexcept {
17391  return max;
17392  }
17393 
17394 
17395 
17396  /// \}
17397 
17398  /// \name Setters
17399  /// \{
17400 
17401 
17402  /**
17403  * \brief Set token for the current ast node
17404  */
17405  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
17406 
17407 
17408 
17409 
17410  /**
17411  * \brief Setter for member variable \ref Limits.min (rvalue reference)
17412  */
17413  void set_min(std::shared_ptr<Double>&& min);
17414 
17415  /**
17416  * \brief Setter for member variable \ref Limits.min
17417  */
17418  void set_min(const std::shared_ptr<Double>& min);
17419 
17420 
17421  /**
17422  * \brief Setter for member variable \ref Limits.max (rvalue reference)
17423  */
17424  void set_max(std::shared_ptr<Double>&& max);
17425 
17426  /**
17427  * \brief Setter for member variable \ref Limits.max
17428  */
17429  void set_max(const std::shared_ptr<Double>& max);
17430 
17431 
17432  /// \}
17433 
17434  /// \name Visitor
17435  /// \{
17436 
17437  /**
17438  * \brief visit children i.e. member variables of current node using provided visitor
17439  *
17440  * Different nodes in the AST have different members (i.e. children). This method
17441  * recursively visits children using provided visitor.
17442  *
17443  * \param v Concrete visitor that will be used to recursively visit children
17444  *
17445  * \sa Ast::visit_children for example.
17446  */
17447  void visit_children(visitor::Visitor& v) override;
17448 
17449  /**
17450  * \brief visit children i.e. member variables of current node using provided visitor
17451  *
17452  * Different nodes in the AST have different members (i.e. children). This method
17453  * recursively visits children using provided visitor.
17454  *
17455  * \param v Concrete constant visitor that will be used to recursively visit children
17456  *
17457  * \sa Ast::visit_children for example.
17458  */
17459  void visit_children(visitor::ConstVisitor& v) const override;
17460 
17461  /**
17462  * \brief accept (or visit) the current AST node using provided visitor
17463  *
17464  * Instead of visiting children of AST node, like Ast::visit_children,
17465  * accept allows to visit the current node itself using provided concrete
17466  * visitor.
17467  *
17468  * \param v Concrete visitor that will be used to recursively visit node
17469  *
17470  * \sa Ast::accept for example.
17471  */
17472  void accept(visitor::Visitor& v) override;
17473 
17474  /**
17475  * \copydoc accept(visitor::Visitor&)
17476  */
17477  void accept(visitor::ConstVisitor& v) const override;
17478 
17479  /// \}
17480 
17481 
17482 
17483  private:
17484  /**
17485  * \brief Set this object as parent for all the children
17486  *
17487  * This should be called in every object (with children) constructor
17488  * to set parents. Since it is called only in the constructors it
17489  * should not be virtual to avoid ambiguities (issue #295).
17490  */
17491  void set_parent_in_children();
17492 };
17493 
17494 /** @} */ // end of ast_class
17495 
17496 
17497 } // namespace ast
17498 } // namespace nmodl
17499 #endif // !NMODL_AST_LIMITS_HPP
17500 #ifndef NMODL_AST_NUMBER_RANGE_HPP
17501 #define NMODL_AST_NUMBER_RANGE_HPP
17502 
17503 
17504 namespace nmodl {
17505 namespace ast {
17506 
17507 /**
17508  * @addtogroup ast_class
17509  * @ingroup ast
17510  * @{
17511  */
17512 
17513 /**
17514  * \brief TODO
17515  *
17516  *
17517 */
17518 class NumberRange : public Expression {
17519  private:
17520  /// TODO
17521  std::shared_ptr<Number> min;
17522  /// TODO
17523  std::shared_ptr<Number> max;
17524  /// token with location information
17525  std::shared_ptr<ModToken> token;
17526 
17527  public:
17528 
17529  /// \name Ctor & dtor
17530  /// \{
17531 
17532  explicit NumberRange(Number* min, Number* max);
17533  explicit NumberRange(const std::shared_ptr<Number>& min, const std::shared_ptr<Number>& max);
17534  NumberRange(const NumberRange& obj);
17535 
17536 
17537  virtual ~NumberRange() = default;
17538 
17539  /// \}
17540 
17541 
17542 
17543 
17544 
17545 
17546  /**
17547  * \brief Check if the ast node is an instance of ast::NumberRange
17548  * \return true as object is of type ast::NumberRange
17549  */
17550  bool is_number_range () const noexcept override {
17551  return true;
17552  }
17553 
17554  /**
17555  * \brief Return a copy of the current node
17556  *
17557  * Recursively make a new copy/clone of the current node including
17558  * all members and return a pointer to the node. This is used for
17559  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17560  * ast.
17561  *
17562  * @return pointer to the clone/copy of the current node
17563  */
17564  NumberRange* clone() const override {
17565  return new NumberRange(*this);
17566  }
17567 
17568  /// \name Getters
17569  /// \{
17570 
17571  /**
17572  * \brief Return type (ast::AstNodeType) of ast node
17573  *
17574  * Every node in the ast has a type defined in ast::AstNodeType and this
17575  * function is used to retrieve the same.
17576  *
17577  * \return ast node type i.e. ast::AstNodeType::NUMBER_RANGE
17578  *
17579  * \sa Ast::get_node_type_name
17580  */
17581  AstNodeType get_node_type() const noexcept override {
17583  }
17584 
17585  /**
17586  * \brief Return type (ast::AstNodeType) of ast node as std::string
17587  *
17588  * Every node in the ast has a type defined in ast::AstNodeType.
17589  * This type name can be returned as a std::string for printing
17590  * node to text/json form.
17591  *
17592  * \return name of the node type as a string i.e. "NumberRange"
17593  *
17594  * \sa Ast::get_node_name
17595  */
17596  std::string get_node_type_name() const noexcept override {
17597  return "NumberRange";
17598  }
17599 
17600 
17601  /**
17602  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17603  */
17604  std::shared_ptr<Ast> get_shared_ptr() override {
17605  return std::static_pointer_cast<NumberRange>(shared_from_this());
17606  }
17607 
17608  /**
17609  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17610  */
17611  std::shared_ptr<const Ast> get_shared_ptr() const override {
17612  return std::static_pointer_cast<const NumberRange>(shared_from_this());
17613  }
17614 
17615  /**
17616  * \brief Return associated token for the current ast node
17617  *
17618  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
17619  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
17620  * nullptr to store in the nmodl::symtab::SymbolTable.
17621  *
17622  * \return pointer to token if exist otherwise nullptr
17623  */
17624  const ModToken* get_token() const noexcept override {
17625  return token.get();
17626  }
17627 
17628 
17629 
17630 
17631 
17632 
17633 
17634 
17635  /**
17636  * \brief Getter for member variable \ref NumberRange.min
17637  */
17638  const std::shared_ptr<Number>& get_min() const noexcept {
17639  return min;
17640  }
17641 
17642 
17643 
17644 
17645 
17646 
17647 
17648  /**
17649  * \brief Getter for member variable \ref NumberRange.max
17650  */
17651  const std::shared_ptr<Number>& get_max() const noexcept {
17652  return max;
17653  }
17654 
17655 
17656 
17657  /// \}
17658 
17659  /// \name Setters
17660  /// \{
17661 
17662 
17663  /**
17664  * \brief Set token for the current ast node
17665  */
17666  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
17667 
17668 
17669 
17670 
17671  /**
17672  * \brief Setter for member variable \ref NumberRange.min (rvalue reference)
17673  */
17674  void set_min(std::shared_ptr<Number>&& min);
17675 
17676  /**
17677  * \brief Setter for member variable \ref NumberRange.min
17678  */
17679  void set_min(const std::shared_ptr<Number>& min);
17680 
17681 
17682  /**
17683  * \brief Setter for member variable \ref NumberRange.max (rvalue reference)
17684  */
17685  void set_max(std::shared_ptr<Number>&& max);
17686 
17687  /**
17688  * \brief Setter for member variable \ref NumberRange.max
17689  */
17690  void set_max(const std::shared_ptr<Number>& max);
17691 
17692 
17693  /// \}
17694 
17695  /// \name Visitor
17696  /// \{
17697 
17698  /**
17699  * \brief visit children i.e. member variables of current node using provided visitor
17700  *
17701  * Different nodes in the AST have different members (i.e. children). This method
17702  * recursively visits children using provided visitor.
17703  *
17704  * \param v Concrete visitor that will be used to recursively visit children
17705  *
17706  * \sa Ast::visit_children for example.
17707  */
17708  void visit_children(visitor::Visitor& v) override;
17709 
17710  /**
17711  * \brief visit children i.e. member variables of current node using provided visitor
17712  *
17713  * Different nodes in the AST have different members (i.e. children). This method
17714  * recursively visits children using provided visitor.
17715  *
17716  * \param v Concrete constant visitor that will be used to recursively visit children
17717  *
17718  * \sa Ast::visit_children for example.
17719  */
17720  void visit_children(visitor::ConstVisitor& v) const override;
17721 
17722  /**
17723  * \brief accept (or visit) the current AST node using provided visitor
17724  *
17725  * Instead of visiting children of AST node, like Ast::visit_children,
17726  * accept allows to visit the current node itself using provided concrete
17727  * visitor.
17728  *
17729  * \param v Concrete visitor that will be used to recursively visit node
17730  *
17731  * \sa Ast::accept for example.
17732  */
17733  void accept(visitor::Visitor& v) override;
17734 
17735  /**
17736  * \copydoc accept(visitor::Visitor&)
17737  */
17738  void accept(visitor::ConstVisitor& v) const override;
17739 
17740  /// \}
17741 
17742 
17743 
17744  private:
17745  /**
17746  * \brief Set this object as parent for all the children
17747  *
17748  * This should be called in every object (with children) constructor
17749  * to set parents. Since it is called only in the constructors it
17750  * should not be virtual to avoid ambiguities (issue #295).
17751  */
17752  void set_parent_in_children();
17753 };
17754 
17755 /** @} */ // end of ast_class
17756 
17757 
17758 } // namespace ast
17759 } // namespace nmodl
17760 #endif // !NMODL_AST_NUMBER_RANGE_HPP
17761 #ifndef NMODL_AST_PLOT_VAR_HPP
17762 #define NMODL_AST_PLOT_VAR_HPP
17763 
17764 
17765 namespace nmodl {
17766 namespace ast {
17767 
17768 /**
17769  * @addtogroup ast_class
17770  * @ingroup ast
17771  * @{
17772  */
17773 
17774 /**
17775  * \brief TODO
17776  *
17777  *
17778 */
17779 class PlotVar : public Expression {
17780  private:
17781  /// TODO
17782  std::shared_ptr<Identifier> name;
17783  /// TODO
17784  std::shared_ptr<Integer> index;
17785  /// token with location information
17786  std::shared_ptr<ModToken> token;
17787 
17788  public:
17789 
17790  /// \name Ctor & dtor
17791  /// \{
17792 
17793  explicit PlotVar(Identifier* name, Integer* index);
17794  explicit PlotVar(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Integer>& index);
17795  PlotVar(const PlotVar& obj);
17796 
17797 
17798  virtual ~PlotVar() = default;
17799 
17800  /// \}
17801 
17802 
17803 
17804 
17805 
17806 
17807  /**
17808  * \brief Check if the ast node is an instance of ast::PlotVar
17809  * \return true as object is of type ast::PlotVar
17810  */
17811  bool is_plot_var () const noexcept override {
17812  return true;
17813  }
17814 
17815  /**
17816  * \brief Return a copy of the current node
17817  *
17818  * Recursively make a new copy/clone of the current node including
17819  * all members and return a pointer to the node. This is used for
17820  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17821  * ast.
17822  *
17823  * @return pointer to the clone/copy of the current node
17824  */
17825  PlotVar* clone() const override {
17826  return new PlotVar(*this);
17827  }
17828 
17829  /// \name Getters
17830  /// \{
17831 
17832  /**
17833  * \brief Return type (ast::AstNodeType) of ast node
17834  *
17835  * Every node in the ast has a type defined in ast::AstNodeType and this
17836  * function is used to retrieve the same.
17837  *
17838  * \return ast node type i.e. ast::AstNodeType::PLOT_VAR
17839  *
17840  * \sa Ast::get_node_type_name
17841  */
17842  AstNodeType get_node_type() const noexcept override {
17843  return AstNodeType::PLOT_VAR;
17844  }
17845 
17846  /**
17847  * \brief Return type (ast::AstNodeType) of ast node as std::string
17848  *
17849  * Every node in the ast has a type defined in ast::AstNodeType.
17850  * This type name can be returned as a std::string for printing
17851  * node to text/json form.
17852  *
17853  * \return name of the node type as a string i.e. "PlotVar"
17854  *
17855  * \sa Ast::get_node_name
17856  */
17857  std::string get_node_type_name() const noexcept override {
17858  return "PlotVar";
17859  }
17860 
17861 
17862  /**
17863  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17864  */
17865  std::shared_ptr<Ast> get_shared_ptr() override {
17866  return std::static_pointer_cast<PlotVar>(shared_from_this());
17867  }
17868 
17869  /**
17870  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17871  */
17872  std::shared_ptr<const Ast> get_shared_ptr() const override {
17873  return std::static_pointer_cast<const PlotVar>(shared_from_this());
17874  }
17875 
17876  /**
17877  * \brief Return associated token for the current ast node
17878  *
17879  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
17880  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
17881  * nullptr to store in the nmodl::symtab::SymbolTable.
17882  *
17883  * \return pointer to token if exist otherwise nullptr
17884  */
17885  const ModToken* get_token() const noexcept override {
17886  return token.get();
17887  }
17888 
17889 
17890 
17891 
17892 
17893 
17894 
17895 
17896  /**
17897  * \brief Getter for member variable \ref PlotVar.name
17898  */
17899  const std::shared_ptr<Identifier>& get_name() const noexcept {
17900  return name;
17901  }
17902 
17903 
17904 
17905 
17906 
17907 
17908 
17909  /**
17910  * \brief Getter for member variable \ref PlotVar.index
17911  */
17912  const std::shared_ptr<Integer>& get_index() const noexcept {
17913  return index;
17914  }
17915 
17916 
17917 
17918  /// \}
17919 
17920  /// \name Setters
17921  /// \{
17922 
17923 
17924  /**
17925  * \brief Set token for the current ast node
17926  */
17927  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
17928 
17929 
17930 
17931 
17932  /**
17933  * \brief Setter for member variable \ref PlotVar.name (rvalue reference)
17934  */
17935  void set_name(std::shared_ptr<Identifier>&& name);
17936 
17937  /**
17938  * \brief Setter for member variable \ref PlotVar.name
17939  */
17940  void set_name(const std::shared_ptr<Identifier>& name);
17941 
17942 
17943  /**
17944  * \brief Setter for member variable \ref PlotVar.index (rvalue reference)
17945  */
17946  void set_index(std::shared_ptr<Integer>&& index);
17947 
17948  /**
17949  * \brief Setter for member variable \ref PlotVar.index
17950  */
17951  void set_index(const std::shared_ptr<Integer>& index);
17952 
17953 
17954  /// \}
17955 
17956  /// \name Visitor
17957  /// \{
17958 
17959  /**
17960  * \brief visit children i.e. member variables of current node using provided visitor
17961  *
17962  * Different nodes in the AST have different members (i.e. children). This method
17963  * recursively visits children using provided visitor.
17964  *
17965  * \param v Concrete visitor that will be used to recursively visit children
17966  *
17967  * \sa Ast::visit_children for example.
17968  */
17969  void visit_children(visitor::Visitor& v) override;
17970 
17971  /**
17972  * \brief visit children i.e. member variables of current node using provided visitor
17973  *
17974  * Different nodes in the AST have different members (i.e. children). This method
17975  * recursively visits children using provided visitor.
17976  *
17977  * \param v Concrete constant visitor that will be used to recursively visit children
17978  *
17979  * \sa Ast::visit_children for example.
17980  */
17981  void visit_children(visitor::ConstVisitor& v) const override;
17982 
17983  /**
17984  * \brief accept (or visit) the current AST node using provided visitor
17985  *
17986  * Instead of visiting children of AST node, like Ast::visit_children,
17987  * accept allows to visit the current node itself using provided concrete
17988  * visitor.
17989  *
17990  * \param v Concrete visitor that will be used to recursively visit node
17991  *
17992  * \sa Ast::accept for example.
17993  */
17994  void accept(visitor::Visitor& v) override;
17995 
17996  /**
17997  * \copydoc accept(visitor::Visitor&)
17998  */
17999  void accept(visitor::ConstVisitor& v) const override;
18000 
18001  /// \}
18002 
18003 
18004 
18005  private:
18006  /**
18007  * \brief Set this object as parent for all the children
18008  *
18009  * This should be called in every object (with children) constructor
18010  * to set parents. Since it is called only in the constructors it
18011  * should not be virtual to avoid ambiguities (issue #295).
18012  */
18013  void set_parent_in_children();
18014 };
18015 
18016 /** @} */ // end of ast_class
18017 
18018 
18019 } // namespace ast
18020 } // namespace nmodl
18021 #endif // !NMODL_AST_PLOT_VAR_HPP
18022 #ifndef NMODL_AST_CONSTANT_VAR_HPP
18023 #define NMODL_AST_CONSTANT_VAR_HPP
18024 
18025 
18026 namespace nmodl {
18027 namespace ast {
18028 
18029 /**
18030  * @addtogroup ast_class
18031  * @ingroup ast
18032  * @{
18033  */
18034 
18035 /**
18036  * \brief Represents a variable in the ast::ConstantBlock
18037  *
18038  *
18039 */
18040 class ConstantVar : public Expression {
18041  private:
18042  /// Name of the variable
18043  std::shared_ptr<Name> name;
18044  /// Value of the constant
18045  std::shared_ptr<Number> value;
18046  /// Unit for the variable
18047  std::shared_ptr<Unit> unit;
18048  /// token with location information
18049  std::shared_ptr<ModToken> token;
18050 
18051  public:
18052 
18053  /// \name Ctor & dtor
18054  /// \{
18055 
18056  explicit ConstantVar(Name* name, Number* value, Unit* unit);
18057  explicit ConstantVar(const std::shared_ptr<Name>& name, const std::shared_ptr<Number>& value, const std::shared_ptr<Unit>& unit);
18058  ConstantVar(const ConstantVar& obj);
18059 
18060 
18061  virtual ~ConstantVar() = default;
18062 
18063  /// \}
18064 
18065 
18066 
18067 
18068 
18069 
18070  /**
18071  * \brief Check if the ast node is an instance of ast::ConstantVar
18072  * \return true as object is of type ast::ConstantVar
18073  */
18074  bool is_constant_var () const noexcept override {
18075  return true;
18076  }
18077 
18078  /**
18079  * \brief Return a copy of the current node
18080  *
18081  * Recursively make a new copy/clone of the current node including
18082  * all members and return a pointer to the node. This is used for
18083  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18084  * ast.
18085  *
18086  * @return pointer to the clone/copy of the current node
18087  */
18088  ConstantVar* clone() const override {
18089  return new ConstantVar(*this);
18090  }
18091 
18092  /// \name Getters
18093  /// \{
18094 
18095  /**
18096  * \brief Return type (ast::AstNodeType) of ast node
18097  *
18098  * Every node in the ast has a type defined in ast::AstNodeType and this
18099  * function is used to retrieve the same.
18100  *
18101  * \return ast node type i.e. ast::AstNodeType::CONSTANT_VAR
18102  *
18103  * \sa Ast::get_node_type_name
18104  */
18105  AstNodeType get_node_type() const noexcept override {
18107  }
18108 
18109  /**
18110  * \brief Return type (ast::AstNodeType) of ast node as std::string
18111  *
18112  * Every node in the ast has a type defined in ast::AstNodeType.
18113  * This type name can be returned as a std::string for printing
18114  * node to text/json form.
18115  *
18116  * \return name of the node type as a string i.e. "ConstantVar"
18117  *
18118  * \sa Ast::get_node_name
18119  */
18120  std::string get_node_type_name() const noexcept override {
18121  return "ConstantVar";
18122  }
18123 
18124 
18125  /**
18126  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18127  */
18128  std::shared_ptr<Ast> get_shared_ptr() override {
18129  return std::static_pointer_cast<ConstantVar>(shared_from_this());
18130  }
18131 
18132  /**
18133  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18134  */
18135  std::shared_ptr<const Ast> get_shared_ptr() const override {
18136  return std::static_pointer_cast<const ConstantVar>(shared_from_this());
18137  }
18138 
18139  /**
18140  * \brief Return associated token for the current ast node
18141  *
18142  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
18143  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
18144  * nullptr to store in the nmodl::symtab::SymbolTable.
18145  *
18146  * \return pointer to token if exist otherwise nullptr
18147  */
18148  const ModToken* get_token() const noexcept override {
18149  return token.get();
18150  }
18151 
18152 
18153 
18154 
18155 
18156 
18157 /**
18158  * \brief Return name of the node
18159  *
18160  * Some ast nodes have a member marked designated as node name. For example,
18161  * in case of this ast::Name has name designated as a
18162  * node name.
18163  *
18164  * @return name of the node as std::string
18165  *
18166  * \sa Ast::get_node_type_name
18167  */
18168 std::string get_node_name() const override;
18169 
18170 
18171  /**
18172  * \brief Getter for member variable \ref ConstantVar.name
18173  */
18174  const std::shared_ptr<Name>& get_name() const noexcept {
18175  return name;
18176  }
18177 
18178 
18179 
18180 
18181 
18182 
18183 
18184  /**
18185  * \brief Getter for member variable \ref ConstantVar.value
18186  */
18187  const std::shared_ptr<Number>& get_value() const noexcept {
18188  return value;
18189  }
18190 
18191 
18192 
18193 
18194 
18195 
18196 
18197  /**
18198  * \brief Getter for member variable \ref ConstantVar.unit
18199  */
18200  const std::shared_ptr<Unit>& get_unit() const noexcept {
18201  return unit;
18202  }
18203 
18204 
18205 
18206  /// \}
18207 
18208  /// \name Setters
18209  /// \{
18210 
18211 
18212  /**
18213  * \brief Set token for the current ast node
18214  */
18215  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
18216 
18217 
18218 
18219 
18220  /**
18221  * \brief Setter for member variable \ref ConstantVar.name (rvalue reference)
18222  */
18223  void set_name(std::shared_ptr<Name>&& name);
18224 
18225  /**
18226  * \brief Setter for member variable \ref ConstantVar.name
18227  */
18228  void set_name(const std::shared_ptr<Name>& name);
18229 
18230 
18231  /**
18232  * \brief Setter for member variable \ref ConstantVar.value (rvalue reference)
18233  */
18234  void set_value(std::shared_ptr<Number>&& value);
18235 
18236  /**
18237  * \brief Setter for member variable \ref ConstantVar.value
18238  */
18239  void set_value(const std::shared_ptr<Number>& value);
18240 
18241 
18242  /**
18243  * \brief Setter for member variable \ref ConstantVar.unit (rvalue reference)
18244  */
18245  void set_unit(std::shared_ptr<Unit>&& unit);
18246 
18247  /**
18248  * \brief Setter for member variable \ref ConstantVar.unit
18249  */
18250  void set_unit(const std::shared_ptr<Unit>& unit);
18251 
18252 
18253  /// \}
18254 
18255  /// \name Visitor
18256  /// \{
18257 
18258  /**
18259  * \brief visit children i.e. member variables of current node using provided visitor
18260  *
18261  * Different nodes in the AST have different members (i.e. children). This method
18262  * recursively visits children using provided visitor.
18263  *
18264  * \param v Concrete visitor that will be used to recursively visit children
18265  *
18266  * \sa Ast::visit_children for example.
18267  */
18268  void visit_children(visitor::Visitor& v) override;
18269 
18270  /**
18271  * \brief visit children i.e. member variables of current node using provided visitor
18272  *
18273  * Different nodes in the AST have different members (i.e. children). This method
18274  * recursively visits children using provided visitor.
18275  *
18276  * \param v Concrete constant visitor that will be used to recursively visit children
18277  *
18278  * \sa Ast::visit_children for example.
18279  */
18280  void visit_children(visitor::ConstVisitor& v) const override;
18281 
18282  /**
18283  * \brief accept (or visit) the current AST node using provided visitor
18284  *
18285  * Instead of visiting children of AST node, like Ast::visit_children,
18286  * accept allows to visit the current node itself using provided concrete
18287  * visitor.
18288  *
18289  * \param v Concrete visitor that will be used to recursively visit node
18290  *
18291  * \sa Ast::accept for example.
18292  */
18293  void accept(visitor::Visitor& v) override;
18294 
18295  /**
18296  * \copydoc accept(visitor::Visitor&)
18297  */
18298  void accept(visitor::ConstVisitor& v) const override;
18299 
18300  /// \}
18301 
18302 
18303 
18304  private:
18305  /**
18306  * \brief Set this object as parent for all the children
18307  *
18308  * This should be called in every object (with children) constructor
18309  * to set parents. Since it is called only in the constructors it
18310  * should not be virtual to avoid ambiguities (issue #295).
18311  */
18312  void set_parent_in_children();
18313 };
18314 
18315 /** @} */ // end of ast_class
18316 
18317 
18318 } // namespace ast
18319 } // namespace nmodl
18320 #endif // !NMODL_AST_CONSTANT_VAR_HPP
18321 #ifndef NMODL_AST_BINARY_OPERATOR_HPP
18322 #define NMODL_AST_BINARY_OPERATOR_HPP
18323 
18324 
18325 namespace nmodl {
18326 namespace ast {
18327 
18328 /**
18329  * @addtogroup ast_class
18330  * @ingroup ast
18331  * @{
18332  */
18333 
18334 /**
18335  * \brief Operator used in ast::BinaryExpression
18336  *
18337  *
18338 */
18339 class BinaryOperator : public Expression {
18340  private:
18341  /// Operator
18343  /// token with location information
18344  std::shared_ptr<ModToken> token;
18345 
18346  public:
18347 
18348  /// \name Ctor & dtor
18349  /// \{
18350 
18351  explicit BinaryOperator(BinaryOp value);
18352  BinaryOperator(const BinaryOperator& obj);
18353 
18354  BinaryOperator() = default;
18355 
18356  virtual ~BinaryOperator() = default;
18357 
18358  /// \}
18359 
18360 
18361 
18362 
18363 
18364 
18365  /**
18366  * \brief Check if the ast node is an instance of ast::BinaryOperator
18367  * \return true as object is of type ast::BinaryOperator
18368  */
18369  bool is_binary_operator () const noexcept override {
18370  return true;
18371  }
18372 
18373  /**
18374  * \brief Return a copy of the current node
18375  *
18376  * Recursively make a new copy/clone of the current node including
18377  * all members and return a pointer to the node. This is used for
18378  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18379  * ast.
18380  *
18381  * @return pointer to the clone/copy of the current node
18382  */
18383  BinaryOperator* clone() const override {
18384  return new BinaryOperator(*this);
18385  }
18386 
18387  /// \name Getters
18388  /// \{
18389 
18390  /**
18391  * \brief Return type (ast::AstNodeType) of ast node
18392  *
18393  * Every node in the ast has a type defined in ast::AstNodeType and this
18394  * function is used to retrieve the same.
18395  *
18396  * \return ast node type i.e. ast::AstNodeType::BINARY_OPERATOR
18397  *
18398  * \sa Ast::get_node_type_name
18399  */
18400  AstNodeType get_node_type() const noexcept override {
18402  }
18403 
18404  /**
18405  * \brief Return type (ast::AstNodeType) of ast node as std::string
18406  *
18407  * Every node in the ast has a type defined in ast::AstNodeType.
18408  * This type name can be returned as a std::string for printing
18409  * node to text/json form.
18410  *
18411  * \return name of the node type as a string i.e. "BinaryOperator"
18412  *
18413  * \sa Ast::get_node_name
18414  */
18415  std::string get_node_type_name() const noexcept override {
18416  return "BinaryOperator";
18417  }
18418 
18419 
18420  /**
18421  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18422  */
18423  std::shared_ptr<Ast> get_shared_ptr() override {
18424  return std::static_pointer_cast<BinaryOperator>(shared_from_this());
18425  }
18426 
18427  /**
18428  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18429  */
18430  std::shared_ptr<const Ast> get_shared_ptr() const override {
18431  return std::static_pointer_cast<const BinaryOperator>(shared_from_this());
18432  }
18433 
18434  /**
18435  * \brief Return associated token for the current ast node
18436  *
18437  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
18438  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
18439  * nullptr to store in the nmodl::symtab::SymbolTable.
18440  *
18441  * \return pointer to token if exist otherwise nullptr
18442  */
18443  const ModToken* get_token() const noexcept override {
18444  return token.get();
18445  }
18446 
18447 
18448 
18449 
18450 
18451 
18452 
18453 
18454  /**
18455  * \brief Getter for member variable \ref BinaryOperator.value
18456  */
18457  BinaryOp get_value() const noexcept {
18458  return value;
18459  }
18460 
18461 
18462 
18463  /// \}
18464 
18465  /// \name Setters
18466  /// \{
18467 
18468 
18469  /**
18470  * \brief Set token for the current ast node
18471  */
18472  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
18473 
18474 
18475 
18476 
18477  /**
18478  * \brief Setter for member variable \ref BinaryOperator.value
18479  */
18480  void set_value(BinaryOp value);
18481 
18482 
18483  /// \}
18484 
18485  /// \name Visitor
18486  /// \{
18487 
18488  /**
18489  * \brief visit children i.e. member variables of current node using provided visitor
18490  *
18491  * Different nodes in the AST have different members (i.e. children). This method
18492  * recursively visits children using provided visitor.
18493  *
18494  * \param v Concrete visitor that will be used to recursively visit children
18495  *
18496  * \sa Ast::visit_children for example.
18497  */
18498  void visit_children(visitor::Visitor& v) override;
18499 
18500  /**
18501  * \brief visit children i.e. member variables of current node using provided visitor
18502  *
18503  * Different nodes in the AST have different members (i.e. children). This method
18504  * recursively visits children using provided visitor.
18505  *
18506  * \param v Concrete constant visitor that will be used to recursively visit children
18507  *
18508  * \sa Ast::visit_children for example.
18509  */
18510  void visit_children(visitor::ConstVisitor& v) const override;
18511 
18512  /**
18513  * \brief accept (or visit) the current AST node using provided visitor
18514  *
18515  * Instead of visiting children of AST node, like Ast::visit_children,
18516  * accept allows to visit the current node itself using provided concrete
18517  * visitor.
18518  *
18519  * \param v Concrete visitor that will be used to recursively visit node
18520  *
18521  * \sa Ast::accept for example.
18522  */
18523  void accept(visitor::Visitor& v) override;
18524 
18525  /**
18526  * \copydoc accept(visitor::Visitor&)
18527  */
18528  void accept(visitor::ConstVisitor& v) const override;
18529 
18530  /// \}
18531 
18532 
18533  /**
18534  * \brief Return enum value in string form
18535  *
18536  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
18537  * string representation when they are converted from AST back to
18538  * NMODL. This method is used to return corresponding string representation.
18539  */
18540  std::string eval() const {
18541  return BinaryOpNames[value];
18542  }
18543 
18544 
18545  private:
18546  /**
18547  * \brief Set this object as parent for all the children
18548  *
18549  * This should be called in every object (with children) constructor
18550  * to set parents. Since it is called only in the constructors it
18551  * should not be virtual to avoid ambiguities (issue #295).
18552  */
18553  void set_parent_in_children();
18554 };
18555 
18556 /** @} */ // end of ast_class
18557 
18558 
18559 } // namespace ast
18560 } // namespace nmodl
18561 #endif // !NMODL_AST_BINARY_OPERATOR_HPP
18562 #ifndef NMODL_AST_UNARY_OPERATOR_HPP
18563 #define NMODL_AST_UNARY_OPERATOR_HPP
18564 
18565 
18566 namespace nmodl {
18567 namespace ast {
18568 
18569 /**
18570  * @addtogroup ast_class
18571  * @ingroup ast
18572  * @{
18573  */
18574 
18575 /**
18576  * \brief TODO
18577  *
18578  *
18579 */
18580 class UnaryOperator : public Expression {
18581  private:
18582  /// TODO
18584  /// token with location information
18585  std::shared_ptr<ModToken> token;
18586 
18587  public:
18588 
18589  /// \name Ctor & dtor
18590  /// \{
18591 
18592  explicit UnaryOperator(UnaryOp value);
18593  UnaryOperator(const UnaryOperator& obj);
18594 
18595  UnaryOperator() = default;
18596 
18597  virtual ~UnaryOperator() = default;
18598 
18599  /// \}
18600 
18601 
18602 
18603 
18604 
18605 
18606  /**
18607  * \brief Check if the ast node is an instance of ast::UnaryOperator
18608  * \return true as object is of type ast::UnaryOperator
18609  */
18610  bool is_unary_operator () const noexcept override {
18611  return true;
18612  }
18613 
18614  /**
18615  * \brief Return a copy of the current node
18616  *
18617  * Recursively make a new copy/clone of the current node including
18618  * all members and return a pointer to the node. This is used for
18619  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18620  * ast.
18621  *
18622  * @return pointer to the clone/copy of the current node
18623  */
18624  UnaryOperator* clone() const override {
18625  return new UnaryOperator(*this);
18626  }
18627 
18628  /// \name Getters
18629  /// \{
18630 
18631  /**
18632  * \brief Return type (ast::AstNodeType) of ast node
18633  *
18634  * Every node in the ast has a type defined in ast::AstNodeType and this
18635  * function is used to retrieve the same.
18636  *
18637  * \return ast node type i.e. ast::AstNodeType::UNARY_OPERATOR
18638  *
18639  * \sa Ast::get_node_type_name
18640  */
18641  AstNodeType get_node_type() const noexcept override {
18643  }
18644 
18645  /**
18646  * \brief Return type (ast::AstNodeType) of ast node as std::string
18647  *
18648  * Every node in the ast has a type defined in ast::AstNodeType.
18649  * This type name can be returned as a std::string for printing
18650  * node to text/json form.
18651  *
18652  * \return name of the node type as a string i.e. "UnaryOperator"
18653  *
18654  * \sa Ast::get_node_name
18655  */
18656  std::string get_node_type_name() const noexcept override {
18657  return "UnaryOperator";
18658  }
18659 
18660 
18661  /**
18662  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18663  */
18664  std::shared_ptr<Ast> get_shared_ptr() override {
18665  return std::static_pointer_cast<UnaryOperator>(shared_from_this());
18666  }
18667 
18668  /**
18669  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18670  */
18671  std::shared_ptr<const Ast> get_shared_ptr() const override {
18672  return std::static_pointer_cast<const UnaryOperator>(shared_from_this());
18673  }
18674 
18675  /**
18676  * \brief Return associated token for the current ast node
18677  *
18678  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
18679  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
18680  * nullptr to store in the nmodl::symtab::SymbolTable.
18681  *
18682  * \return pointer to token if exist otherwise nullptr
18683  */
18684  const ModToken* get_token() const noexcept override {
18685  return token.get();
18686  }
18687 
18688 
18689 
18690 
18691 
18692 
18693 
18694 
18695  /**
18696  * \brief Getter for member variable \ref UnaryOperator.value
18697  */
18698  UnaryOp get_value() const noexcept {
18699  return value;
18700  }
18701 
18702 
18703 
18704  /// \}
18705 
18706  /// \name Setters
18707  /// \{
18708 
18709 
18710  /**
18711  * \brief Set token for the current ast node
18712  */
18713  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
18714 
18715 
18716 
18717 
18718  /**
18719  * \brief Setter for member variable \ref UnaryOperator.value
18720  */
18721  void set_value(UnaryOp value);
18722 
18723 
18724  /// \}
18725 
18726  /// \name Visitor
18727  /// \{
18728 
18729  /**
18730  * \brief visit children i.e. member variables of current node using provided visitor
18731  *
18732  * Different nodes in the AST have different members (i.e. children). This method
18733  * recursively visits children using provided visitor.
18734  *
18735  * \param v Concrete visitor that will be used to recursively visit children
18736  *
18737  * \sa Ast::visit_children for example.
18738  */
18739  void visit_children(visitor::Visitor& v) override;
18740 
18741  /**
18742  * \brief visit children i.e. member variables of current node using provided visitor
18743  *
18744  * Different nodes in the AST have different members (i.e. children). This method
18745  * recursively visits children using provided visitor.
18746  *
18747  * \param v Concrete constant visitor that will be used to recursively visit children
18748  *
18749  * \sa Ast::visit_children for example.
18750  */
18751  void visit_children(visitor::ConstVisitor& v) const override;
18752 
18753  /**
18754  * \brief accept (or visit) the current AST node using provided visitor
18755  *
18756  * Instead of visiting children of AST node, like Ast::visit_children,
18757  * accept allows to visit the current node itself using provided concrete
18758  * visitor.
18759  *
18760  * \param v Concrete visitor that will be used to recursively visit node
18761  *
18762  * \sa Ast::accept for example.
18763  */
18764  void accept(visitor::Visitor& v) override;
18765 
18766  /**
18767  * \copydoc accept(visitor::Visitor&)
18768  */
18769  void accept(visitor::ConstVisitor& v) const override;
18770 
18771  /// \}
18772 
18773 
18774  /**
18775  * \brief Return enum value in string form
18776  *
18777  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
18778  * string representation when they are converted from AST back to
18779  * NMODL. This method is used to return corresponding string representation.
18780  */
18781  std::string eval() const {
18782  return UnaryOpNames[value];
18783  }
18784 
18785 
18786  private:
18787  /**
18788  * \brief Set this object as parent for all the children
18789  *
18790  * This should be called in every object (with children) constructor
18791  * to set parents. Since it is called only in the constructors it
18792  * should not be virtual to avoid ambiguities (issue #295).
18793  */
18794  void set_parent_in_children();
18795 };
18796 
18797 /** @} */ // end of ast_class
18798 
18799 
18800 } // namespace ast
18801 } // namespace nmodl
18802 #endif // !NMODL_AST_UNARY_OPERATOR_HPP
18803 #ifndef NMODL_AST_REACTION_OPERATOR_HPP
18804 #define NMODL_AST_REACTION_OPERATOR_HPP
18805 
18806 
18807 namespace nmodl {
18808 namespace ast {
18809 
18810 /**
18811  * @addtogroup ast_class
18812  * @ingroup ast
18813  * @{
18814  */
18815 
18816 /**
18817  * \brief TODO
18818  *
18819  *
18820 */
18822  private:
18823  /// TODO
18825  /// token with location information
18826  std::shared_ptr<ModToken> token;
18827 
18828  public:
18829 
18830  /// \name Ctor & dtor
18831  /// \{
18832 
18833  explicit ReactionOperator(ReactionOp value);
18834  ReactionOperator(const ReactionOperator& obj);
18835 
18836  ReactionOperator() = default;
18837 
18838  virtual ~ReactionOperator() = default;
18839 
18840  /// \}
18841 
18842 
18843 
18844 
18845 
18846 
18847  /**
18848  * \brief Check if the ast node is an instance of ast::ReactionOperator
18849  * \return true as object is of type ast::ReactionOperator
18850  */
18851  bool is_reaction_operator () const noexcept override {
18852  return true;
18853  }
18854 
18855  /**
18856  * \brief Return a copy of the current node
18857  *
18858  * Recursively make a new copy/clone of the current node including
18859  * all members and return a pointer to the node. This is used for
18860  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18861  * ast.
18862  *
18863  * @return pointer to the clone/copy of the current node
18864  */
18865  ReactionOperator* clone() const override {
18866  return new ReactionOperator(*this);
18867  }
18868 
18869  /// \name Getters
18870  /// \{
18871 
18872  /**
18873  * \brief Return type (ast::AstNodeType) of ast node
18874  *
18875  * Every node in the ast has a type defined in ast::AstNodeType and this
18876  * function is used to retrieve the same.
18877  *
18878  * \return ast node type i.e. ast::AstNodeType::REACTION_OPERATOR
18879  *
18880  * \sa Ast::get_node_type_name
18881  */
18882  AstNodeType get_node_type() const noexcept override {
18884  }
18885 
18886  /**
18887  * \brief Return type (ast::AstNodeType) of ast node as std::string
18888  *
18889  * Every node in the ast has a type defined in ast::AstNodeType.
18890  * This type name can be returned as a std::string for printing
18891  * node to text/json form.
18892  *
18893  * \return name of the node type as a string i.e. "ReactionOperator"
18894  *
18895  * \sa Ast::get_node_name
18896  */
18897  std::string get_node_type_name() const noexcept override {
18898  return "ReactionOperator";
18899  }
18900 
18901 
18902  /**
18903  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18904  */
18905  std::shared_ptr<Ast> get_shared_ptr() override {
18906  return std::static_pointer_cast<ReactionOperator>(shared_from_this());
18907  }
18908 
18909  /**
18910  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18911  */
18912  std::shared_ptr<const Ast> get_shared_ptr() const override {
18913  return std::static_pointer_cast<const ReactionOperator>(shared_from_this());
18914  }
18915 
18916  /**
18917  * \brief Return associated token for the current ast node
18918  *
18919  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
18920  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
18921  * nullptr to store in the nmodl::symtab::SymbolTable.
18922  *
18923  * \return pointer to token if exist otherwise nullptr
18924  */
18925  const ModToken* get_token() const noexcept override {
18926  return token.get();
18927  }
18928 
18929 
18930 
18931 
18932 
18933 
18934 
18935 
18936  /**
18937  * \brief Getter for member variable \ref ReactionOperator.value
18938  */
18939  ReactionOp get_value() const noexcept {
18940  return value;
18941  }
18942 
18943 
18944 
18945  /// \}
18946 
18947  /// \name Setters
18948  /// \{
18949 
18950 
18951  /**
18952  * \brief Set token for the current ast node
18953  */
18954  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
18955 
18956 
18957 
18958 
18959  /**
18960  * \brief Setter for member variable \ref ReactionOperator.value
18961  */
18962  void set_value(ReactionOp value);
18963 
18964 
18965  /// \}
18966 
18967  /// \name Visitor
18968  /// \{
18969 
18970  /**
18971  * \brief visit children i.e. member variables of current node using provided visitor
18972  *
18973  * Different nodes in the AST have different members (i.e. children). This method
18974  * recursively visits children using provided visitor.
18975  *
18976  * \param v Concrete visitor that will be used to recursively visit children
18977  *
18978  * \sa Ast::visit_children for example.
18979  */
18980  void visit_children(visitor::Visitor& v) override;
18981 
18982  /**
18983  * \brief visit children i.e. member variables of current node using provided visitor
18984  *
18985  * Different nodes in the AST have different members (i.e. children). This method
18986  * recursively visits children using provided visitor.
18987  *
18988  * \param v Concrete constant visitor that will be used to recursively visit children
18989  *
18990  * \sa Ast::visit_children for example.
18991  */
18992  void visit_children(visitor::ConstVisitor& v) const override;
18993 
18994  /**
18995  * \brief accept (or visit) the current AST node using provided visitor
18996  *
18997  * Instead of visiting children of AST node, like Ast::visit_children,
18998  * accept allows to visit the current node itself using provided concrete
18999  * visitor.
19000  *
19001  * \param v Concrete visitor that will be used to recursively visit node
19002  *
19003  * \sa Ast::accept for example.
19004  */
19005  void accept(visitor::Visitor& v) override;
19006 
19007  /**
19008  * \copydoc accept(visitor::Visitor&)
19009  */
19010  void accept(visitor::ConstVisitor& v) const override;
19011 
19012  /// \}
19013 
19014 
19015  /**
19016  * \brief Return enum value in string form
19017  *
19018  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
19019  * string representation when they are converted from AST back to
19020  * NMODL. This method is used to return corresponding string representation.
19021  */
19022  std::string eval() const {
19023  return ReactionOpNames[value];
19024  }
19025 
19026 
19027  private:
19028  /**
19029  * \brief Set this object as parent for all the children
19030  *
19031  * This should be called in every object (with children) constructor
19032  * to set parents. Since it is called only in the constructors it
19033  * should not be virtual to avoid ambiguities (issue #295).
19034  */
19035  void set_parent_in_children();
19036 };
19037 
19038 /** @} */ // end of ast_class
19039 
19040 
19041 } // namespace ast
19042 } // namespace nmodl
19043 #endif // !NMODL_AST_REACTION_OPERATOR_HPP
19044 #ifndef NMODL_AST_PAREN_EXPRESSION_HPP
19045 #define NMODL_AST_PAREN_EXPRESSION_HPP
19046 
19047 
19048 namespace nmodl {
19049 namespace ast {
19050 
19051 /**
19052  * @addtogroup ast_class
19053  * @ingroup ast
19054  * @{
19055  */
19056 
19057 /**
19058  * \brief TODO
19059  *
19060  *
19061 */
19062 class ParenExpression : public Expression {
19063  private:
19064  /// TODO
19065  std::shared_ptr<Expression> expression;
19066  /// token with location information
19067  std::shared_ptr<ModToken> token;
19068 
19069  public:
19070 
19071  /// \name Ctor & dtor
19072  /// \{
19073 
19074  explicit ParenExpression(Expression* expression);
19075  explicit ParenExpression(const std::shared_ptr<Expression>& expression);
19076  ParenExpression(const ParenExpression& obj);
19077 
19078 
19079  virtual ~ParenExpression() = default;
19080 
19081  /// \}
19082 
19083 
19084 
19085 
19086 
19087 
19088  /**
19089  * \brief Check if the ast node is an instance of ast::ParenExpression
19090  * \return true as object is of type ast::ParenExpression
19091  */
19092  bool is_paren_expression () const noexcept override {
19093  return true;
19094  }
19095 
19096  /**
19097  * \brief Return a copy of the current node
19098  *
19099  * Recursively make a new copy/clone of the current node including
19100  * all members and return a pointer to the node. This is used for
19101  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19102  * ast.
19103  *
19104  * @return pointer to the clone/copy of the current node
19105  */
19106  ParenExpression* clone() const override {
19107  return new ParenExpression(*this);
19108  }
19109 
19110  /// \name Getters
19111  /// \{
19112 
19113  /**
19114  * \brief Return type (ast::AstNodeType) of ast node
19115  *
19116  * Every node in the ast has a type defined in ast::AstNodeType and this
19117  * function is used to retrieve the same.
19118  *
19119  * \return ast node type i.e. ast::AstNodeType::PAREN_EXPRESSION
19120  *
19121  * \sa Ast::get_node_type_name
19122  */
19123  AstNodeType get_node_type() const noexcept override {
19125  }
19126 
19127  /**
19128  * \brief Return type (ast::AstNodeType) of ast node as std::string
19129  *
19130  * Every node in the ast has a type defined in ast::AstNodeType.
19131  * This type name can be returned as a std::string for printing
19132  * node to text/json form.
19133  *
19134  * \return name of the node type as a string i.e. "ParenExpression"
19135  *
19136  * \sa Ast::get_node_name
19137  */
19138  std::string get_node_type_name() const noexcept override {
19139  return "ParenExpression";
19140  }
19141 
19142 
19143  /**
19144  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19145  */
19146  std::shared_ptr<Ast> get_shared_ptr() override {
19147  return std::static_pointer_cast<ParenExpression>(shared_from_this());
19148  }
19149 
19150  /**
19151  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19152  */
19153  std::shared_ptr<const Ast> get_shared_ptr() const override {
19154  return std::static_pointer_cast<const ParenExpression>(shared_from_this());
19155  }
19156 
19157  /**
19158  * \brief Return associated token for the current ast node
19159  *
19160  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
19161  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
19162  * nullptr to store in the nmodl::symtab::SymbolTable.
19163  *
19164  * \return pointer to token if exist otherwise nullptr
19165  */
19166  const ModToken* get_token() const noexcept override {
19167  return token.get();
19168  }
19169 
19170 
19171 
19172 
19173 
19174 
19175 
19176 
19177  /**
19178  * \brief Getter for member variable \ref ParenExpression.expression
19179  */
19180  const std::shared_ptr<Expression>& get_expression() const noexcept {
19181  return expression;
19182  }
19183 
19184 
19185 
19186  /// \}
19187 
19188  /// \name Setters
19189  /// \{
19190 
19191 
19192  /**
19193  * \brief Set token for the current ast node
19194  */
19195  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
19196 
19197 
19198 
19199 
19200  /**
19201  * \brief Setter for member variable \ref ParenExpression.expression (rvalue reference)
19202  */
19203  void set_expression(std::shared_ptr<Expression>&& expression);
19204 
19205  /**
19206  * \brief Setter for member variable \ref ParenExpression.expression
19207  */
19208  void set_expression(const std::shared_ptr<Expression>& expression);
19209 
19210 
19211  /// \}
19212 
19213  /// \name Visitor
19214  /// \{
19215 
19216  /**
19217  * \brief visit children i.e. member variables of current node using provided visitor
19218  *
19219  * Different nodes in the AST have different members (i.e. children). This method
19220  * recursively visits children using provided visitor.
19221  *
19222  * \param v Concrete visitor that will be used to recursively visit children
19223  *
19224  * \sa Ast::visit_children for example.
19225  */
19226  void visit_children(visitor::Visitor& v) override;
19227 
19228  /**
19229  * \brief visit children i.e. member variables of current node using provided visitor
19230  *
19231  * Different nodes in the AST have different members (i.e. children). This method
19232  * recursively visits children using provided visitor.
19233  *
19234  * \param v Concrete constant visitor that will be used to recursively visit children
19235  *
19236  * \sa Ast::visit_children for example.
19237  */
19238  void visit_children(visitor::ConstVisitor& v) const override;
19239 
19240  /**
19241  * \brief accept (or visit) the current AST node using provided visitor
19242  *
19243  * Instead of visiting children of AST node, like Ast::visit_children,
19244  * accept allows to visit the current node itself using provided concrete
19245  * visitor.
19246  *
19247  * \param v Concrete visitor that will be used to recursively visit node
19248  *
19249  * \sa Ast::accept for example.
19250  */
19251  void accept(visitor::Visitor& v) override;
19252 
19253  /**
19254  * \copydoc accept(visitor::Visitor&)
19255  */
19256  void accept(visitor::ConstVisitor& v) const override;
19257 
19258  /// \}
19259 
19260 
19261 
19262  private:
19263  /**
19264  * \brief Set this object as parent for all the children
19265  *
19266  * This should be called in every object (with children) constructor
19267  * to set parents. Since it is called only in the constructors it
19268  * should not be virtual to avoid ambiguities (issue #295).
19269  */
19270  void set_parent_in_children();
19271 };
19272 
19273 /** @} */ // end of ast_class
19274 
19275 
19276 } // namespace ast
19277 } // namespace nmodl
19278 #endif // !NMODL_AST_PAREN_EXPRESSION_HPP
19279 #ifndef NMODL_AST_BINARY_EXPRESSION_HPP
19280 #define NMODL_AST_BINARY_EXPRESSION_HPP
19281 
19282 
19283 namespace nmodl {
19284 namespace ast {
19285 
19286 /**
19287  * @addtogroup ast_class
19288  * @ingroup ast
19289  * @{
19290  */
19291 
19292 /**
19293  * \brief Represents binary expression in the NMODL
19294  *
19295  * Any binary expression in the mod file is represented by this node type.
19296  * For example, in below example, there are three binary expressions :
19297  *
19298  * \code{.mod}
19299  * BREAKPOINT {
19300  * SOLVE states METHOD cnexp
19301  * ina = gna*(v - ena)
19302  * }
19303  * \endcode
19304  *
19305  * Note that the statement itself is stored in another type ast::ExpressionStatement.
19306  *
19307  * \sa ast::ExpressionStatement
19308  *
19309 */
19311  private:
19312  /// LHS of the binary expression
19313  std::shared_ptr<Expression> lhs;
19314  /// Operator
19316  /// RHS of the binary expression
19317  std::shared_ptr<Expression> rhs;
19318  /// token with location information
19319  std::shared_ptr<ModToken> token;
19320 
19321  public:
19322 
19323  /// \name Ctor & dtor
19324  /// \{
19325 
19326  explicit BinaryExpression(Expression* lhs, const BinaryOperator& op, Expression* rhs);
19327  explicit BinaryExpression(const std::shared_ptr<Expression>& lhs, const BinaryOperator& op, const std::shared_ptr<Expression>& rhs);
19328  BinaryExpression(const BinaryExpression& obj);
19329 
19330 
19331  virtual ~BinaryExpression() = default;
19332 
19333  /// \}
19334 
19335 
19336 
19337 
19338 
19339 
19340  /**
19341  * \brief Check if the ast node is an instance of ast::BinaryExpression
19342  * \return true as object is of type ast::BinaryExpression
19343  */
19344  bool is_binary_expression () const noexcept override {
19345  return true;
19346  }
19347 
19348  /**
19349  * \brief Return a copy of the current node
19350  *
19351  * Recursively make a new copy/clone of the current node including
19352  * all members and return a pointer to the node. This is used for
19353  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19354  * ast.
19355  *
19356  * @return pointer to the clone/copy of the current node
19357  */
19358  BinaryExpression* clone() const override {
19359  return new BinaryExpression(*this);
19360  }
19361 
19362  /// \name Getters
19363  /// \{
19364 
19365  /**
19366  * \brief Return type (ast::AstNodeType) of ast node
19367  *
19368  * Every node in the ast has a type defined in ast::AstNodeType and this
19369  * function is used to retrieve the same.
19370  *
19371  * \return ast node type i.e. ast::AstNodeType::BINARY_EXPRESSION
19372  *
19373  * \sa Ast::get_node_type_name
19374  */
19375  AstNodeType get_node_type() const noexcept override {
19377  }
19378 
19379  /**
19380  * \brief Return type (ast::AstNodeType) of ast node as std::string
19381  *
19382  * Every node in the ast has a type defined in ast::AstNodeType.
19383  * This type name can be returned as a std::string for printing
19384  * node to text/json form.
19385  *
19386  * \return name of the node type as a string i.e. "BinaryExpression"
19387  *
19388  * \sa Ast::get_node_name
19389  */
19390  std::string get_node_type_name() const noexcept override {
19391  return "BinaryExpression";
19392  }
19393 
19394 
19395  /**
19396  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19397  */
19398  std::shared_ptr<Ast> get_shared_ptr() override {
19399  return std::static_pointer_cast<BinaryExpression>(shared_from_this());
19400  }
19401 
19402  /**
19403  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19404  */
19405  std::shared_ptr<const Ast> get_shared_ptr() const override {
19406  return std::static_pointer_cast<const BinaryExpression>(shared_from_this());
19407  }
19408 
19409  /**
19410  * \brief Return associated token for the current ast node
19411  *
19412  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
19413  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
19414  * nullptr to store in the nmodl::symtab::SymbolTable.
19415  *
19416  * \return pointer to token if exist otherwise nullptr
19417  */
19418  const ModToken* get_token() const noexcept override {
19419  return token.get();
19420  }
19421 
19422 
19423 
19424 
19425 
19426 
19427 
19428 
19429  /**
19430  * \brief Getter for member variable \ref BinaryExpression.lhs
19431  */
19432  const std::shared_ptr<Expression>& get_lhs() const noexcept {
19433  return lhs;
19434  }
19435 
19436 
19437 
19438 
19439 
19440 
19441 
19442  /**
19443  * \brief Getter for member variable \ref BinaryExpression.op
19444  */
19445  const BinaryOperator& get_op() const noexcept {
19446  return op;
19447  }
19448 
19449 
19450 
19451 
19452 
19453 
19454 
19455  /**
19456  * \brief Getter for member variable \ref BinaryExpression.rhs
19457  */
19458  const std::shared_ptr<Expression>& get_rhs() const noexcept {
19459  return rhs;
19460  }
19461 
19462 
19463 
19464  /// \}
19465 
19466  /// \name Setters
19467  /// \{
19468 
19469 
19470  /**
19471  * \brief Set token for the current ast node
19472  */
19473  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
19474 
19475 
19476 
19477 
19478  /**
19479  * \brief Setter for member variable \ref BinaryExpression.lhs (rvalue reference)
19480  */
19481  void set_lhs(std::shared_ptr<Expression>&& lhs);
19482 
19483  /**
19484  * \brief Setter for member variable \ref BinaryExpression.lhs
19485  */
19486  void set_lhs(const std::shared_ptr<Expression>& lhs);
19487 
19488 
19489  /**
19490  * \brief Setter for member variable \ref BinaryExpression.op (rvalue reference)
19491  */
19492  void set_op(BinaryOperator&& op);
19493 
19494  /**
19495  * \brief Setter for member variable \ref BinaryExpression.op
19496  */
19497  void set_op(const BinaryOperator& op);
19498 
19499 
19500  /**
19501  * \brief Setter for member variable \ref BinaryExpression.rhs (rvalue reference)
19502  */
19503  void set_rhs(std::shared_ptr<Expression>&& rhs);
19504 
19505  /**
19506  * \brief Setter for member variable \ref BinaryExpression.rhs
19507  */
19508  void set_rhs(const std::shared_ptr<Expression>& rhs);
19509 
19510 
19511  /// \}
19512 
19513  /// \name Visitor
19514  /// \{
19515 
19516  /**
19517  * \brief visit children i.e. member variables of current node using provided visitor
19518  *
19519  * Different nodes in the AST have different members (i.e. children). This method
19520  * recursively visits children using provided visitor.
19521  *
19522  * \param v Concrete visitor that will be used to recursively visit children
19523  *
19524  * \sa Ast::visit_children for example.
19525  */
19526  void visit_children(visitor::Visitor& v) override;
19527 
19528  /**
19529  * \brief visit children i.e. member variables of current node using provided visitor
19530  *
19531  * Different nodes in the AST have different members (i.e. children). This method
19532  * recursively visits children using provided visitor.
19533  *
19534  * \param v Concrete constant visitor that will be used to recursively visit children
19535  *
19536  * \sa Ast::visit_children for example.
19537  */
19538  void visit_children(visitor::ConstVisitor& v) const override;
19539 
19540  /**
19541  * \brief accept (or visit) the current AST node using provided visitor
19542  *
19543  * Instead of visiting children of AST node, like Ast::visit_children,
19544  * accept allows to visit the current node itself using provided concrete
19545  * visitor.
19546  *
19547  * \param v Concrete visitor that will be used to recursively visit node
19548  *
19549  * \sa Ast::accept for example.
19550  */
19551  void accept(visitor::Visitor& v) override;
19552 
19553  /**
19554  * \copydoc accept(visitor::Visitor&)
19555  */
19556  void accept(visitor::ConstVisitor& v) const override;
19557 
19558  /// \}
19559 
19560 
19561 
19562  private:
19563  /**
19564  * \brief Set this object as parent for all the children
19565  *
19566  * This should be called in every object (with children) constructor
19567  * to set parents. Since it is called only in the constructors it
19568  * should not be virtual to avoid ambiguities (issue #295).
19569  */
19570  void set_parent_in_children();
19571 };
19572 
19573 /** @} */ // end of ast_class
19574 
19575 
19576 } // namespace ast
19577 } // namespace nmodl
19578 #endif // !NMODL_AST_BINARY_EXPRESSION_HPP
19579 #ifndef NMODL_AST_DIFF_EQ_EXPRESSION_HPP
19580 #define NMODL_AST_DIFF_EQ_EXPRESSION_HPP
19581 
19582 
19583 namespace nmodl {
19584 namespace ast {
19585 
19586 /**
19587  * @addtogroup ast_class
19588  * @ingroup ast
19589  * @{
19590  */
19591 
19592 /**
19593  * \brief Represents differential equation in DERIVATIVE block
19594  *
19595  *
19596 */
19598  private:
19599  /// Differential Expression
19600  std::shared_ptr<BinaryExpression> expression;
19601  /// token with location information
19602  std::shared_ptr<ModToken> token;
19603 
19604  public:
19605 
19606  /// \name Ctor & dtor
19607  /// \{
19608 
19609  explicit DiffEqExpression(BinaryExpression* expression);
19610  explicit DiffEqExpression(const std::shared_ptr<BinaryExpression>& expression);
19611  DiffEqExpression(const DiffEqExpression& obj);
19612 
19613 
19614  virtual ~DiffEqExpression() = default;
19615 
19616  /// \}
19617 
19618 
19619 
19620 
19621 
19622 
19623  /**
19624  * \brief Check if the ast node is an instance of ast::DiffEqExpression
19625  * \return true as object is of type ast::DiffEqExpression
19626  */
19627  bool is_diff_eq_expression () const noexcept override {
19628  return true;
19629  }
19630 
19631  /**
19632  * \brief Return a copy of the current node
19633  *
19634  * Recursively make a new copy/clone of the current node including
19635  * all members and return a pointer to the node. This is used for
19636  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19637  * ast.
19638  *
19639  * @return pointer to the clone/copy of the current node
19640  */
19641  DiffEqExpression* clone() const override {
19642  return new DiffEqExpression(*this);
19643  }
19644 
19645  /// \name Getters
19646  /// \{
19647 
19648  /**
19649  * \brief Return type (ast::AstNodeType) of ast node
19650  *
19651  * Every node in the ast has a type defined in ast::AstNodeType and this
19652  * function is used to retrieve the same.
19653  *
19654  * \return ast node type i.e. ast::AstNodeType::DIFF_EQ_EXPRESSION
19655  *
19656  * \sa Ast::get_node_type_name
19657  */
19658  AstNodeType get_node_type() const noexcept override {
19660  }
19661 
19662  /**
19663  * \brief Return type (ast::AstNodeType) of ast node as std::string
19664  *
19665  * Every node in the ast has a type defined in ast::AstNodeType.
19666  * This type name can be returned as a std::string for printing
19667  * node to text/json form.
19668  *
19669  * \return name of the node type as a string i.e. "DiffEqExpression"
19670  *
19671  * \sa Ast::get_node_name
19672  */
19673  std::string get_node_type_name() const noexcept override {
19674  return "DiffEqExpression";
19675  }
19676 
19677 
19678  /**
19679  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19680  */
19681  std::shared_ptr<Ast> get_shared_ptr() override {
19682  return std::static_pointer_cast<DiffEqExpression>(shared_from_this());
19683  }
19684 
19685  /**
19686  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19687  */
19688  std::shared_ptr<const Ast> get_shared_ptr() const override {
19689  return std::static_pointer_cast<const DiffEqExpression>(shared_from_this());
19690  }
19691 
19692  /**
19693  * \brief Return associated token for the current ast node
19694  *
19695  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
19696  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
19697  * nullptr to store in the nmodl::symtab::SymbolTable.
19698  *
19699  * \return pointer to token if exist otherwise nullptr
19700  */
19701  const ModToken* get_token() const noexcept override {
19702  return token.get();
19703  }
19704 
19705 
19706 
19707 
19708 
19709 
19710 
19711 
19712  /**
19713  * \brief Getter for member variable \ref DiffEqExpression.expression
19714  */
19715  const std::shared_ptr<BinaryExpression>& get_expression() const noexcept {
19716  return expression;
19717  }
19718 
19719 
19720 
19721  /// \}
19722 
19723  /// \name Setters
19724  /// \{
19725 
19726 
19727  /**
19728  * \brief Set token for the current ast node
19729  */
19730  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
19731 
19732 
19733 
19734 
19735  /**
19736  * \brief Setter for member variable \ref DiffEqExpression.expression (rvalue reference)
19737  */
19738  void set_expression(std::shared_ptr<BinaryExpression>&& expression);
19739 
19740  /**
19741  * \brief Setter for member variable \ref DiffEqExpression.expression
19742  */
19743  void set_expression(const std::shared_ptr<BinaryExpression>& expression);
19744 
19745 
19746  /// \}
19747 
19748  /// \name Visitor
19749  /// \{
19750 
19751  /**
19752  * \brief visit children i.e. member variables of current node using provided visitor
19753  *
19754  * Different nodes in the AST have different members (i.e. children). This method
19755  * recursively visits children using provided visitor.
19756  *
19757  * \param v Concrete visitor that will be used to recursively visit children
19758  *
19759  * \sa Ast::visit_children for example.
19760  */
19761  void visit_children(visitor::Visitor& v) override;
19762 
19763  /**
19764  * \brief visit children i.e. member variables of current node using provided visitor
19765  *
19766  * Different nodes in the AST have different members (i.e. children). This method
19767  * recursively visits children using provided visitor.
19768  *
19769  * \param v Concrete constant visitor that will be used to recursively visit children
19770  *
19771  * \sa Ast::visit_children for example.
19772  */
19773  void visit_children(visitor::ConstVisitor& v) const override;
19774 
19775  /**
19776  * \brief accept (or visit) the current AST node using provided visitor
19777  *
19778  * Instead of visiting children of AST node, like Ast::visit_children,
19779  * accept allows to visit the current node itself using provided concrete
19780  * visitor.
19781  *
19782  * \param v Concrete visitor that will be used to recursively visit node
19783  *
19784  * \sa Ast::accept for example.
19785  */
19786  void accept(visitor::Visitor& v) override;
19787 
19788  /**
19789  * \copydoc accept(visitor::Visitor&)
19790  */
19791  void accept(visitor::ConstVisitor& v) const override;
19792 
19793  /// \}
19794 
19795 
19796 
19797  private:
19798  /**
19799  * \brief Set this object as parent for all the children
19800  *
19801  * This should be called in every object (with children) constructor
19802  * to set parents. Since it is called only in the constructors it
19803  * should not be virtual to avoid ambiguities (issue #295).
19804  */
19805  void set_parent_in_children();
19806 };
19807 
19808 /** @} */ // end of ast_class
19809 
19810 
19811 } // namespace ast
19812 } // namespace nmodl
19813 #endif // !NMODL_AST_DIFF_EQ_EXPRESSION_HPP
19814 #ifndef NMODL_AST_UNARY_EXPRESSION_HPP
19815 #define NMODL_AST_UNARY_EXPRESSION_HPP
19816 
19817 
19818 namespace nmodl {
19819 namespace ast {
19820 
19821 /**
19822  * @addtogroup ast_class
19823  * @ingroup ast
19824  * @{
19825  */
19826 
19827 /**
19828  * \brief TODO
19829  *
19830  *
19831 */
19832 class UnaryExpression : public Expression {
19833  private:
19834  /// TODO
19836  /// TODO
19837  std::shared_ptr<Expression> expression;
19838  /// token with location information
19839  std::shared_ptr<ModToken> token;
19840 
19841  public:
19842 
19843  /// \name Ctor & dtor
19844  /// \{
19845 
19846  explicit UnaryExpression(const UnaryOperator& op, Expression* expression);
19847  explicit UnaryExpression(const UnaryOperator& op, const std::shared_ptr<Expression>& expression);
19848  UnaryExpression(const UnaryExpression& obj);
19849 
19850 
19851  virtual ~UnaryExpression() = default;
19852 
19853  /// \}
19854 
19855 
19856 
19857 
19858 
19859 
19860  /**
19861  * \brief Check if the ast node is an instance of ast::UnaryExpression
19862  * \return true as object is of type ast::UnaryExpression
19863  */
19864  bool is_unary_expression () const noexcept override {
19865  return true;
19866  }
19867 
19868  /**
19869  * \brief Return a copy of the current node
19870  *
19871  * Recursively make a new copy/clone of the current node including
19872  * all members and return a pointer to the node. This is used for
19873  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19874  * ast.
19875  *
19876  * @return pointer to the clone/copy of the current node
19877  */
19878  UnaryExpression* clone() const override {
19879  return new UnaryExpression(*this);
19880  }
19881 
19882  /// \name Getters
19883  /// \{
19884 
19885  /**
19886  * \brief Return type (ast::AstNodeType) of ast node
19887  *
19888  * Every node in the ast has a type defined in ast::AstNodeType and this
19889  * function is used to retrieve the same.
19890  *
19891  * \return ast node type i.e. ast::AstNodeType::UNARY_EXPRESSION
19892  *
19893  * \sa Ast::get_node_type_name
19894  */
19895  AstNodeType get_node_type() const noexcept override {
19897  }
19898 
19899  /**
19900  * \brief Return type (ast::AstNodeType) of ast node as std::string
19901  *
19902  * Every node in the ast has a type defined in ast::AstNodeType.
19903  * This type name can be returned as a std::string for printing
19904  * node to text/json form.
19905  *
19906  * \return name of the node type as a string i.e. "UnaryExpression"
19907  *
19908  * \sa Ast::get_node_name
19909  */
19910  std::string get_node_type_name() const noexcept override {
19911  return "UnaryExpression";
19912  }
19913 
19914 
19915  /**
19916  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19917  */
19918  std::shared_ptr<Ast> get_shared_ptr() override {
19919  return std::static_pointer_cast<UnaryExpression>(shared_from_this());
19920  }
19921 
19922  /**
19923  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19924  */
19925  std::shared_ptr<const Ast> get_shared_ptr() const override {
19926  return std::static_pointer_cast<const UnaryExpression>(shared_from_this());
19927  }
19928 
19929  /**
19930  * \brief Return associated token for the current ast node
19931  *
19932  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
19933  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
19934  * nullptr to store in the nmodl::symtab::SymbolTable.
19935  *
19936  * \return pointer to token if exist otherwise nullptr
19937  */
19938  const ModToken* get_token() const noexcept override {
19939  return token.get();
19940  }
19941 
19942 
19943 
19944 
19945 
19946 
19947 
19948 
19949  /**
19950  * \brief Getter for member variable \ref UnaryExpression.op
19951  */
19952  const UnaryOperator& get_op() const noexcept {
19953  return op;
19954  }
19955 
19956 
19957 
19958 
19959 
19960 
19961 
19962  /**
19963  * \brief Getter for member variable \ref UnaryExpression.expression
19964  */
19965  const std::shared_ptr<Expression>& get_expression() const noexcept {
19966  return expression;
19967  }
19968 
19969 
19970 
19971  /// \}
19972 
19973  /// \name Setters
19974  /// \{
19975 
19976 
19977  /**
19978  * \brief Set token for the current ast node
19979  */
19980  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
19981 
19982 
19983 
19984 
19985  /**
19986  * \brief Setter for member variable \ref UnaryExpression.op (rvalue reference)
19987  */
19988  void set_op(UnaryOperator&& op);
19989 
19990  /**
19991  * \brief Setter for member variable \ref UnaryExpression.op
19992  */
19993  void set_op(const UnaryOperator& op);
19994 
19995 
19996  /**
19997  * \brief Setter for member variable \ref UnaryExpression.expression (rvalue reference)
19998  */
19999  void set_expression(std::shared_ptr<Expression>&& expression);
20000 
20001  /**
20002  * \brief Setter for member variable \ref UnaryExpression.expression
20003  */
20004  void set_expression(const std::shared_ptr<Expression>& expression);
20005 
20006 
20007  /// \}
20008 
20009  /// \name Visitor
20010  /// \{
20011 
20012  /**
20013  * \brief visit children i.e. member variables of current node using provided visitor
20014  *
20015  * Different nodes in the AST have different members (i.e. children). This method
20016  * recursively visits children using provided visitor.
20017  *
20018  * \param v Concrete visitor that will be used to recursively visit children
20019  *
20020  * \sa Ast::visit_children for example.
20021  */
20022  void visit_children(visitor::Visitor& v) override;
20023 
20024  /**
20025  * \brief visit children i.e. member variables of current node using provided visitor
20026  *
20027  * Different nodes in the AST have different members (i.e. children). This method
20028  * recursively visits children using provided visitor.
20029  *
20030  * \param v Concrete constant visitor that will be used to recursively visit children
20031  *
20032  * \sa Ast::visit_children for example.
20033  */
20034  void visit_children(visitor::ConstVisitor& v) const override;
20035 
20036  /**
20037  * \brief accept (or visit) the current AST node using provided visitor
20038  *
20039  * Instead of visiting children of AST node, like Ast::visit_children,
20040  * accept allows to visit the current node itself using provided concrete
20041  * visitor.
20042  *
20043  * \param v Concrete visitor that will be used to recursively visit node
20044  *
20045  * \sa Ast::accept for example.
20046  */
20047  void accept(visitor::Visitor& v) override;
20048 
20049  /**
20050  * \copydoc accept(visitor::Visitor&)
20051  */
20052  void accept(visitor::ConstVisitor& v) const override;
20053 
20054  /// \}
20055 
20056 
20057 
20058  private:
20059  /**
20060  * \brief Set this object as parent for all the children
20061  *
20062  * This should be called in every object (with children) constructor
20063  * to set parents. Since it is called only in the constructors it
20064  * should not be virtual to avoid ambiguities (issue #295).
20065  */
20066  void set_parent_in_children();
20067 };
20068 
20069 /** @} */ // end of ast_class
20070 
20071 
20072 } // namespace ast
20073 } // namespace nmodl
20074 #endif // !NMODL_AST_UNARY_EXPRESSION_HPP
20075 #ifndef NMODL_AST_NON_LIN_EQUATION_HPP
20076 #define NMODL_AST_NON_LIN_EQUATION_HPP
20077 
20078 
20079 namespace nmodl {
20080 namespace ast {
20081 
20082 /**
20083  * @addtogroup ast_class
20084  * @ingroup ast
20085  * @{
20086  */
20087 
20088 /**
20089  * \brief TODO
20090  *
20091  *
20092 */
20093 class NonLinEquation : public Expression {
20094  private:
20095  /// TODO
20096  std::shared_ptr<Expression> lhs;
20097  /// TODO
20098  std::shared_ptr<Expression> rhs;
20099  /// token with location information
20100  std::shared_ptr<ModToken> token;
20101 
20102  public:
20103 
20104  /// \name Ctor & dtor
20105  /// \{
20106 
20107  explicit NonLinEquation(Expression* lhs, Expression* rhs);
20108  explicit NonLinEquation(const std::shared_ptr<Expression>& lhs, const std::shared_ptr<Expression>& rhs);
20109  NonLinEquation(const NonLinEquation& obj);
20110 
20111 
20112  virtual ~NonLinEquation() = default;
20113 
20114  /// \}
20115 
20116 
20117 
20118 
20119 
20120 
20121  /**
20122  * \brief Check if the ast node is an instance of ast::NonLinEquation
20123  * \return true as object is of type ast::NonLinEquation
20124  */
20125  bool is_non_lin_equation () const noexcept override {
20126  return true;
20127  }
20128 
20129  /**
20130  * \brief Return a copy of the current node
20131  *
20132  * Recursively make a new copy/clone of the current node including
20133  * all members and return a pointer to the node. This is used for
20134  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20135  * ast.
20136  *
20137  * @return pointer to the clone/copy of the current node
20138  */
20139  NonLinEquation* clone() const override {
20140  return new NonLinEquation(*this);
20141  }
20142 
20143  /// \name Getters
20144  /// \{
20145 
20146  /**
20147  * \brief Return type (ast::AstNodeType) of ast node
20148  *
20149  * Every node in the ast has a type defined in ast::AstNodeType and this
20150  * function is used to retrieve the same.
20151  *
20152  * \return ast node type i.e. ast::AstNodeType::NON_LIN_EQUATION
20153  *
20154  * \sa Ast::get_node_type_name
20155  */
20156  AstNodeType get_node_type() const noexcept override {
20158  }
20159 
20160  /**
20161  * \brief Return type (ast::AstNodeType) of ast node as std::string
20162  *
20163  * Every node in the ast has a type defined in ast::AstNodeType.
20164  * This type name can be returned as a std::string for printing
20165  * node to text/json form.
20166  *
20167  * \return name of the node type as a string i.e. "NonLinEquation"
20168  *
20169  * \sa Ast::get_node_name
20170  */
20171  std::string get_node_type_name() const noexcept override {
20172  return "NonLinEquation";
20173  }
20174 
20175  /**
20176  * \brief Return NMODL statement of ast node as std::string
20177  *
20178  * Every node is related to a special statement in the NMODL. This
20179  * statement can be returned as a std::string for printing to
20180  * text/json form.
20181  *
20182  * \return name of the statement as a string i.e. "~ "
20183  *
20184  * \sa Ast::get_nmodl_name
20185  */
20186  std::string get_nmodl_name() const noexcept override {
20187  return "~ ";
20188  }
20189 
20190  /**
20191  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20192  */
20193  std::shared_ptr<Ast> get_shared_ptr() override {
20194  return std::static_pointer_cast<NonLinEquation>(shared_from_this());
20195  }
20196 
20197  /**
20198  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20199  */
20200  std::shared_ptr<const Ast> get_shared_ptr() const override {
20201  return std::static_pointer_cast<const NonLinEquation>(shared_from_this());
20202  }
20203 
20204  /**
20205  * \brief Return associated token for the current ast node
20206  *
20207  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
20208  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
20209  * nullptr to store in the nmodl::symtab::SymbolTable.
20210  *
20211  * \return pointer to token if exist otherwise nullptr
20212  */
20213  const ModToken* get_token() const noexcept override {
20214  return token.get();
20215  }
20216 
20217 
20218 
20219 
20220 
20221 
20222 
20223 
20224  /**
20225  * \brief Getter for member variable \ref NonLinEquation.lhs
20226  */
20227  const std::shared_ptr<Expression>& get_lhs() const noexcept {
20228  return lhs;
20229  }
20230 
20231 
20232 
20233 
20234 
20235 
20236 
20237  /**
20238  * \brief Getter for member variable \ref NonLinEquation.rhs
20239  */
20240  const std::shared_ptr<Expression>& get_rhs() const noexcept {
20241  return rhs;
20242  }
20243 
20244 
20245 
20246  /// \}
20247 
20248  /// \name Setters
20249  /// \{
20250 
20251 
20252  /**
20253  * \brief Set token for the current ast node
20254  */
20255  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
20256 
20257 
20258 
20259 
20260  /**
20261  * \brief Setter for member variable \ref NonLinEquation.lhs (rvalue reference)
20262  */
20263  void set_lhs(std::shared_ptr<Expression>&& lhs);
20264 
20265  /**
20266  * \brief Setter for member variable \ref NonLinEquation.lhs
20267  */
20268  void set_lhs(const std::shared_ptr<Expression>& lhs);
20269 
20270 
20271  /**
20272  * \brief Setter for member variable \ref NonLinEquation.rhs (rvalue reference)
20273  */
20274  void set_rhs(std::shared_ptr<Expression>&& rhs);
20275 
20276  /**
20277  * \brief Setter for member variable \ref NonLinEquation.rhs
20278  */
20279  void set_rhs(const std::shared_ptr<Expression>& rhs);
20280 
20281 
20282  /// \}
20283 
20284  /// \name Visitor
20285  /// \{
20286 
20287  /**
20288  * \brief visit children i.e. member variables of current node using provided visitor
20289  *
20290  * Different nodes in the AST have different members (i.e. children). This method
20291  * recursively visits children using provided visitor.
20292  *
20293  * \param v Concrete visitor that will be used to recursively visit children
20294  *
20295  * \sa Ast::visit_children for example.
20296  */
20297  void visit_children(visitor::Visitor& v) override;
20298 
20299  /**
20300  * \brief visit children i.e. member variables of current node using provided visitor
20301  *
20302  * Different nodes in the AST have different members (i.e. children). This method
20303  * recursively visits children using provided visitor.
20304  *
20305  * \param v Concrete constant visitor that will be used to recursively visit children
20306  *
20307  * \sa Ast::visit_children for example.
20308  */
20309  void visit_children(visitor::ConstVisitor& v) const override;
20310 
20311  /**
20312  * \brief accept (or visit) the current AST node using provided visitor
20313  *
20314  * Instead of visiting children of AST node, like Ast::visit_children,
20315  * accept allows to visit the current node itself using provided concrete
20316  * visitor.
20317  *
20318  * \param v Concrete visitor that will be used to recursively visit node
20319  *
20320  * \sa Ast::accept for example.
20321  */
20322  void accept(visitor::Visitor& v) override;
20323 
20324  /**
20325  * \copydoc accept(visitor::Visitor&)
20326  */
20327  void accept(visitor::ConstVisitor& v) const override;
20328 
20329  /// \}
20330 
20331 
20332 
20333  private:
20334  /**
20335  * \brief Set this object as parent for all the children
20336  *
20337  * This should be called in every object (with children) constructor
20338  * to set parents. Since it is called only in the constructors it
20339  * should not be virtual to avoid ambiguities (issue #295).
20340  */
20341  void set_parent_in_children();
20342 };
20343 
20344 /** @} */ // end of ast_class
20345 
20346 
20347 } // namespace ast
20348 } // namespace nmodl
20349 #endif // !NMODL_AST_NON_LIN_EQUATION_HPP
20350 #ifndef NMODL_AST_LIN_EQUATION_HPP
20351 #define NMODL_AST_LIN_EQUATION_HPP
20352 
20353 
20354 namespace nmodl {
20355 namespace ast {
20356 
20357 /**
20358  * @addtogroup ast_class
20359  * @ingroup ast
20360  * @{
20361  */
20362 
20363 /**
20364  * \brief TODO
20365  *
20366  *
20367 */
20368 class LinEquation : public Expression {
20369  private:
20370  /// TODO
20371  std::shared_ptr<Expression> left_linxpression;
20372  /// TODO
20373  std::shared_ptr<Expression> linxpression;
20374  /// token with location information
20375  std::shared_ptr<ModToken> token;
20376 
20377  public:
20378 
20379  /// \name Ctor & dtor
20380  /// \{
20381 
20382  explicit LinEquation(Expression* left_linxpression, Expression* linxpression);
20383  explicit LinEquation(const std::shared_ptr<Expression>& left_linxpression, const std::shared_ptr<Expression>& linxpression);
20384  LinEquation(const LinEquation& obj);
20385 
20386 
20387  virtual ~LinEquation() = default;
20388 
20389  /// \}
20390 
20391 
20392 
20393 
20394 
20395 
20396  /**
20397  * \brief Check if the ast node is an instance of ast::LinEquation
20398  * \return true as object is of type ast::LinEquation
20399  */
20400  bool is_lin_equation () const noexcept override {
20401  return true;
20402  }
20403 
20404  /**
20405  * \brief Return a copy of the current node
20406  *
20407  * Recursively make a new copy/clone of the current node including
20408  * all members and return a pointer to the node. This is used for
20409  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20410  * ast.
20411  *
20412  * @return pointer to the clone/copy of the current node
20413  */
20414  LinEquation* clone() const override {
20415  return new LinEquation(*this);
20416  }
20417 
20418  /// \name Getters
20419  /// \{
20420 
20421  /**
20422  * \brief Return type (ast::AstNodeType) of ast node
20423  *
20424  * Every node in the ast has a type defined in ast::AstNodeType and this
20425  * function is used to retrieve the same.
20426  *
20427  * \return ast node type i.e. ast::AstNodeType::LIN_EQUATION
20428  *
20429  * \sa Ast::get_node_type_name
20430  */
20431  AstNodeType get_node_type() const noexcept override {
20433  }
20434 
20435  /**
20436  * \brief Return type (ast::AstNodeType) of ast node as std::string
20437  *
20438  * Every node in the ast has a type defined in ast::AstNodeType.
20439  * This type name can be returned as a std::string for printing
20440  * node to text/json form.
20441  *
20442  * \return name of the node type as a string i.e. "LinEquation"
20443  *
20444  * \sa Ast::get_node_name
20445  */
20446  std::string get_node_type_name() const noexcept override {
20447  return "LinEquation";
20448  }
20449 
20450  /**
20451  * \brief Return NMODL statement of ast node as std::string
20452  *
20453  * Every node is related to a special statement in the NMODL. This
20454  * statement can be returned as a std::string for printing to
20455  * text/json form.
20456  *
20457  * \return name of the statement as a string i.e. "~ "
20458  *
20459  * \sa Ast::get_nmodl_name
20460  */
20461  std::string get_nmodl_name() const noexcept override {
20462  return "~ ";
20463  }
20464 
20465  /**
20466  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20467  */
20468  std::shared_ptr<Ast> get_shared_ptr() override {
20469  return std::static_pointer_cast<LinEquation>(shared_from_this());
20470  }
20471 
20472  /**
20473  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20474  */
20475  std::shared_ptr<const Ast> get_shared_ptr() const override {
20476  return std::static_pointer_cast<const LinEquation>(shared_from_this());
20477  }
20478 
20479  /**
20480  * \brief Return associated token for the current ast node
20481  *
20482  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
20483  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
20484  * nullptr to store in the nmodl::symtab::SymbolTable.
20485  *
20486  * \return pointer to token if exist otherwise nullptr
20487  */
20488  const ModToken* get_token() const noexcept override {
20489  return token.get();
20490  }
20491 
20492 
20493 
20494 
20495 
20496 
20497 
20498 
20499  /**
20500  * \brief Getter for member variable \ref LinEquation.left_linxpression
20501  */
20502  const std::shared_ptr<Expression>& get_left_linxpression() const noexcept {
20503  return left_linxpression;
20504  }
20505 
20506 
20507 
20508 
20509 
20510 
20511 
20512  /**
20513  * \brief Getter for member variable \ref LinEquation.linxpression
20514  */
20515  const std::shared_ptr<Expression>& get_linxpression() const noexcept {
20516  return linxpression;
20517  }
20518 
20519 
20520 
20521  /// \}
20522 
20523  /// \name Setters
20524  /// \{
20525 
20526 
20527  /**
20528  * \brief Set token for the current ast node
20529  */
20530  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
20531 
20532 
20533 
20534 
20535  /**
20536  * \brief Setter for member variable \ref LinEquation.left_linxpression (rvalue reference)
20537  */
20538  void set_left_linxpression(std::shared_ptr<Expression>&& left_linxpression);
20539 
20540  /**
20541  * \brief Setter for member variable \ref LinEquation.left_linxpression
20542  */
20543  void set_left_linxpression(const std::shared_ptr<Expression>& left_linxpression);
20544 
20545 
20546  /**
20547  * \brief Setter for member variable \ref LinEquation.linxpression (rvalue reference)
20548  */
20549  void set_linxpression(std::shared_ptr<Expression>&& linxpression);
20550 
20551  /**
20552  * \brief Setter for member variable \ref LinEquation.linxpression
20553  */
20554  void set_linxpression(const std::shared_ptr<Expression>& linxpression);
20555 
20556 
20557  /// \}
20558 
20559  /// \name Visitor
20560  /// \{
20561 
20562  /**
20563  * \brief visit children i.e. member variables of current node using provided visitor
20564  *
20565  * Different nodes in the AST have different members (i.e. children). This method
20566  * recursively visits children using provided visitor.
20567  *
20568  * \param v Concrete visitor that will be used to recursively visit children
20569  *
20570  * \sa Ast::visit_children for example.
20571  */
20572  void visit_children(visitor::Visitor& v) override;
20573 
20574  /**
20575  * \brief visit children i.e. member variables of current node using provided visitor
20576  *
20577  * Different nodes in the AST have different members (i.e. children). This method
20578  * recursively visits children using provided visitor.
20579  *
20580  * \param v Concrete constant visitor that will be used to recursively visit children
20581  *
20582  * \sa Ast::visit_children for example.
20583  */
20584  void visit_children(visitor::ConstVisitor& v) const override;
20585 
20586  /**
20587  * \brief accept (or visit) the current AST node using provided visitor
20588  *
20589  * Instead of visiting children of AST node, like Ast::visit_children,
20590  * accept allows to visit the current node itself using provided concrete
20591  * visitor.
20592  *
20593  * \param v Concrete visitor that will be used to recursively visit node
20594  *
20595  * \sa Ast::accept for example.
20596  */
20597  void accept(visitor::Visitor& v) override;
20598 
20599  /**
20600  * \copydoc accept(visitor::Visitor&)
20601  */
20602  void accept(visitor::ConstVisitor& v) const override;
20603 
20604  /// \}
20605 
20606 
20607 
20608  private:
20609  /**
20610  * \brief Set this object as parent for all the children
20611  *
20612  * This should be called in every object (with children) constructor
20613  * to set parents. Since it is called only in the constructors it
20614  * should not be virtual to avoid ambiguities (issue #295).
20615  */
20616  void set_parent_in_children();
20617 };
20618 
20619 /** @} */ // end of ast_class
20620 
20621 
20622 } // namespace ast
20623 } // namespace nmodl
20624 #endif // !NMODL_AST_LIN_EQUATION_HPP
20625 #ifndef NMODL_AST_FUNCTION_CALL_HPP
20626 #define NMODL_AST_FUNCTION_CALL_HPP
20627 
20628 
20629 namespace nmodl {
20630 namespace ast {
20631 
20632 /**
20633  * @addtogroup ast_class
20634  * @ingroup ast
20635  * @{
20636  */
20637 
20638 /**
20639  * \brief TODO
20640  *
20641  *
20642 */
20643 class FunctionCall : public Expression {
20644  private:
20645  /// TODO
20646  std::shared_ptr<Name> name;
20647  /// TODO
20649  /// token with location information
20650  std::shared_ptr<ModToken> token;
20651 
20652  public:
20653 
20654  /// \name Ctor & dtor
20655  /// \{
20656 
20657  explicit FunctionCall(Name* name, ExpressionVector arguments);
20658  explicit FunctionCall(const std::shared_ptr<Name>& name, const ExpressionVector& arguments);
20659  FunctionCall(const FunctionCall& obj);
20660 
20661 
20662  virtual ~FunctionCall() = default;
20663 
20664  /// \}
20665 
20666 
20667 
20668 
20669 
20670 
20671  /**
20672  * \brief Check if the ast node is an instance of ast::FunctionCall
20673  * \return true as object is of type ast::FunctionCall
20674  */
20675  bool is_function_call () const noexcept override {
20676  return true;
20677  }
20678 
20679  /**
20680  * \brief Return a copy of the current node
20681  *
20682  * Recursively make a new copy/clone of the current node including
20683  * all members and return a pointer to the node. This is used for
20684  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20685  * ast.
20686  *
20687  * @return pointer to the clone/copy of the current node
20688  */
20689  FunctionCall* clone() const override {
20690  return new FunctionCall(*this);
20691  }
20692 
20693  /// \name Getters
20694  /// \{
20695 
20696  /**
20697  * \brief Return type (ast::AstNodeType) of ast node
20698  *
20699  * Every node in the ast has a type defined in ast::AstNodeType and this
20700  * function is used to retrieve the same.
20701  *
20702  * \return ast node type i.e. ast::AstNodeType::FUNCTION_CALL
20703  *
20704  * \sa Ast::get_node_type_name
20705  */
20706  AstNodeType get_node_type() const noexcept override {
20708  }
20709 
20710  /**
20711  * \brief Return type (ast::AstNodeType) of ast node as std::string
20712  *
20713  * Every node in the ast has a type defined in ast::AstNodeType.
20714  * This type name can be returned as a std::string for printing
20715  * node to text/json form.
20716  *
20717  * \return name of the node type as a string i.e. "FunctionCall"
20718  *
20719  * \sa Ast::get_node_name
20720  */
20721  std::string get_node_type_name() const noexcept override {
20722  return "FunctionCall";
20723  }
20724 
20725 
20726  /**
20727  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20728  */
20729  std::shared_ptr<Ast> get_shared_ptr() override {
20730  return std::static_pointer_cast<FunctionCall>(shared_from_this());
20731  }
20732 
20733  /**
20734  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20735  */
20736  std::shared_ptr<const Ast> get_shared_ptr() const override {
20737  return std::static_pointer_cast<const FunctionCall>(shared_from_this());
20738  }
20739 
20740  /**
20741  * \brief Return associated token for the current ast node
20742  *
20743  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
20744  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
20745  * nullptr to store in the nmodl::symtab::SymbolTable.
20746  *
20747  * \return pointer to token if exist otherwise nullptr
20748  */
20749  const ModToken* get_token() const noexcept override {
20750  return token.get();
20751  }
20752 
20753 
20754 
20755 
20756 
20757 
20758 /**
20759  * \brief Return name of the node
20760  *
20761  * Some ast nodes have a member marked designated as node name. For example,
20762  * in case of this ast::Name has name designated as a
20763  * node name.
20764  *
20765  * @return name of the node as std::string
20766  *
20767  * \sa Ast::get_node_type_name
20768  */
20769 std::string get_node_name() const override;
20770 
20771 
20772  /**
20773  * \brief Getter for member variable \ref FunctionCall.name
20774  */
20775  const std::shared_ptr<Name>& get_name() const noexcept {
20776  return name;
20777  }
20778 
20779 
20780 
20781 
20782 
20783 
20784 
20785  /**
20786  * \brief Getter for member variable \ref FunctionCall.arguments
20787  */
20788  const ExpressionVector& get_arguments() const noexcept {
20789  return arguments;
20790  }
20791 
20792 
20793 
20794  /// \}
20795 
20796  /// \name Setters
20797  /// \{
20798 
20799 
20800  /**
20801  * \brief Set token for the current ast node
20802  */
20803  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
20804 
20805 
20806 
20807 
20808  /**
20809  * \brief Setter for member variable \ref FunctionCall.name (rvalue reference)
20810  */
20811  void set_name(std::shared_ptr<Name>&& name);
20812 
20813  /**
20814  * \brief Setter for member variable \ref FunctionCall.name
20815  */
20816  void set_name(const std::shared_ptr<Name>& name);
20817 
20818 
20819  /**
20820  * \brief Setter for member variable \ref FunctionCall.arguments (rvalue reference)
20821  */
20822  void set_arguments(ExpressionVector&& arguments);
20823 
20824  /**
20825  * \brief Setter for member variable \ref FunctionCall.arguments
20826  */
20827  void set_arguments(const ExpressionVector& arguments);
20828 
20829 
20830  /// \}
20831 
20832  /// \name Visitor
20833  /// \{
20834 
20835  /**
20836  * \brief visit children i.e. member variables of current node using provided visitor
20837  *
20838  * Different nodes in the AST have different members (i.e. children). This method
20839  * recursively visits children using provided visitor.
20840  *
20841  * \param v Concrete visitor that will be used to recursively visit children
20842  *
20843  * \sa Ast::visit_children for example.
20844  */
20845  void visit_children(visitor::Visitor& v) override;
20846 
20847  /**
20848  * \brief visit children i.e. member variables of current node using provided visitor
20849  *
20850  * Different nodes in the AST have different members (i.e. children). This method
20851  * recursively visits children using provided visitor.
20852  *
20853  * \param v Concrete constant visitor that will be used to recursively visit children
20854  *
20855  * \sa Ast::visit_children for example.
20856  */
20857  void visit_children(visitor::ConstVisitor& v) const override;
20858 
20859  /**
20860  * \brief accept (or visit) the current AST node using provided visitor
20861  *
20862  * Instead of visiting children of AST node, like Ast::visit_children,
20863  * accept allows to visit the current node itself using provided concrete
20864  * visitor.
20865  *
20866  * \param v Concrete visitor that will be used to recursively visit node
20867  *
20868  * \sa Ast::accept for example.
20869  */
20870  void accept(visitor::Visitor& v) override;
20871 
20872  /**
20873  * \copydoc accept(visitor::Visitor&)
20874  */
20875  void accept(visitor::ConstVisitor& v) const override;
20876 
20877  /// \}
20878 
20879 
20880 
20881  private:
20882  /**
20883  * \brief Set this object as parent for all the children
20884  *
20885  * This should be called in every object (with children) constructor
20886  * to set parents. Since it is called only in the constructors it
20887  * should not be virtual to avoid ambiguities (issue #295).
20888  */
20889  void set_parent_in_children();
20890 };
20891 
20892 /** @} */ // end of ast_class
20893 
20894 
20895 } // namespace ast
20896 } // namespace nmodl
20897 #endif // !NMODL_AST_FUNCTION_CALL_HPP
20898 #ifndef NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
20899 #define NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
20900 
20901 
20902 namespace nmodl {
20903 namespace ast {
20904 
20905 /**
20906  * @addtogroup ast_class
20907  * @ingroup ast
20908  * @{
20909  */
20910 
20911 /**
20912  * \brief TODO
20913  *
20914  *
20915 */
20917  private:
20918  /// TODO
20920  /// token with location information
20921  std::shared_ptr<ModToken> token;
20922 
20923  public:
20924 
20925  /// \name Ctor & dtor
20926  /// \{
20927 
20928  explicit FirstLastTypeIndex(FirstLastType value);
20930 
20931 
20932  virtual ~FirstLastTypeIndex() = default;
20933 
20934  /// \}
20935 
20936 
20937 
20938 
20939 
20940 
20941  /**
20942  * \brief Check if the ast node is an instance of ast::FirstLastTypeIndex
20943  * \return true as object is of type ast::FirstLastTypeIndex
20944  */
20945  bool is_first_last_type_index () const noexcept override {
20946  return true;
20947  }
20948 
20949  /**
20950  * \brief Return a copy of the current node
20951  *
20952  * Recursively make a new copy/clone of the current node including
20953  * all members and return a pointer to the node. This is used for
20954  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20955  * ast.
20956  *
20957  * @return pointer to the clone/copy of the current node
20958  */
20959  FirstLastTypeIndex* clone() const override {
20960  return new FirstLastTypeIndex(*this);
20961  }
20962 
20963  /// \name Getters
20964  /// \{
20965 
20966  /**
20967  * \brief Return type (ast::AstNodeType) of ast node
20968  *
20969  * Every node in the ast has a type defined in ast::AstNodeType and this
20970  * function is used to retrieve the same.
20971  *
20972  * \return ast node type i.e. ast::AstNodeType::FIRST_LAST_TYPE_INDEX
20973  *
20974  * \sa Ast::get_node_type_name
20975  */
20976  AstNodeType get_node_type() const noexcept override {
20978  }
20979 
20980  /**
20981  * \brief Return type (ast::AstNodeType) of ast node as std::string
20982  *
20983  * Every node in the ast has a type defined in ast::AstNodeType.
20984  * This type name can be returned as a std::string for printing
20985  * node to text/json form.
20986  *
20987  * \return name of the node type as a string i.e. "FirstLastTypeIndex"
20988  *
20989  * \sa Ast::get_node_name
20990  */
20991  std::string get_node_type_name() const noexcept override {
20992  return "FirstLastTypeIndex";
20993  }
20994 
20995 
20996  /**
20997  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20998  */
20999  std::shared_ptr<Ast> get_shared_ptr() override {
21000  return std::static_pointer_cast<FirstLastTypeIndex>(shared_from_this());
21001  }
21002 
21003  /**
21004  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21005  */
21006  std::shared_ptr<const Ast> get_shared_ptr() const override {
21007  return std::static_pointer_cast<const FirstLastTypeIndex>(shared_from_this());
21008  }
21009 
21010  /**
21011  * \brief Return associated token for the current ast node
21012  *
21013  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
21014  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
21015  * nullptr to store in the nmodl::symtab::SymbolTable.
21016  *
21017  * \return pointer to token if exist otherwise nullptr
21018  */
21019  const ModToken* get_token() const noexcept override {
21020  return token.get();
21021  }
21022 
21023 
21024 
21025 
21026 
21027 
21028 
21029 
21030  /**
21031  * \brief Getter for member variable \ref FirstLastTypeIndex.value
21032  */
21033  FirstLastType get_value() const noexcept {
21034  return value;
21035  }
21036 
21037 
21038 
21039  /// \}
21040 
21041  /// \name Setters
21042  /// \{
21043 
21044 
21045  /**
21046  * \brief Set token for the current ast node
21047  */
21048  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
21049 
21050 
21051 
21052 
21053  /**
21054  * \brief Setter for member variable \ref FirstLastTypeIndex.value
21055  */
21056  void set_value(FirstLastType value);
21057 
21058 
21059  /// \}
21060 
21061  /// \name Visitor
21062  /// \{
21063 
21064  /**
21065  * \brief visit children i.e. member variables of current node using provided visitor
21066  *
21067  * Different nodes in the AST have different members (i.e. children). This method
21068  * recursively visits children using provided visitor.
21069  *
21070  * \param v Concrete visitor that will be used to recursively visit children
21071  *
21072  * \sa Ast::visit_children for example.
21073  */
21074  void visit_children(visitor::Visitor& v) override;
21075 
21076  /**
21077  * \brief visit children i.e. member variables of current node using provided visitor
21078  *
21079  * Different nodes in the AST have different members (i.e. children). This method
21080  * recursively visits children using provided visitor.
21081  *
21082  * \param v Concrete constant visitor that will be used to recursively visit children
21083  *
21084  * \sa Ast::visit_children for example.
21085  */
21086  void visit_children(visitor::ConstVisitor& v) const override;
21087 
21088  /**
21089  * \brief accept (or visit) the current AST node using provided visitor
21090  *
21091  * Instead of visiting children of AST node, like Ast::visit_children,
21092  * accept allows to visit the current node itself using provided concrete
21093  * visitor.
21094  *
21095  * \param v Concrete visitor that will be used to recursively visit node
21096  *
21097  * \sa Ast::accept for example.
21098  */
21099  void accept(visitor::Visitor& v) override;
21100 
21101  /**
21102  * \copydoc accept(visitor::Visitor&)
21103  */
21104  void accept(visitor::ConstVisitor& v) const override;
21105 
21106  /// \}
21107 
21108 
21109  /**
21110  * \brief Return enum value in string form
21111  *
21112  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
21113  * string representation when they are converted from AST back to
21114  * NMODL. This method is used to return corresponding string representation.
21115  */
21116  std::string eval() const {
21117  return FirstLastTypeNames[value];
21118  }
21119 
21120 
21121  private:
21122  /**
21123  * \brief Set this object as parent for all the children
21124  *
21125  * This should be called in every object (with children) constructor
21126  * to set parents. Since it is called only in the constructors it
21127  * should not be virtual to avoid ambiguities (issue #295).
21128  */
21129  void set_parent_in_children();
21130 };
21131 
21132 /** @} */ // end of ast_class
21133 
21134 
21135 } // namespace ast
21136 } // namespace nmodl
21137 #endif // !NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
21138 #ifndef NMODL_AST_WATCH_HPP
21139 #define NMODL_AST_WATCH_HPP
21140 
21141 
21142 namespace nmodl {
21143 namespace ast {
21144 
21145 /**
21146  * @addtogroup ast_class
21147  * @ingroup ast
21148  * @{
21149  */
21150 
21151 /**
21152  * \brief TODO
21153  *
21154  *
21155 */
21156 class Watch : public Expression {
21157  private:
21158  /// TODO
21159  std::shared_ptr<Expression> expression;
21160  /// TODO
21161  std::shared_ptr<Expression> value;
21162  /// token with location information
21163  std::shared_ptr<ModToken> token;
21164 
21165  public:
21166 
21167  /// \name Ctor & dtor
21168  /// \{
21169 
21170  explicit Watch(Expression* expression, Expression* value);
21171  explicit Watch(const std::shared_ptr<Expression>& expression, const std::shared_ptr<Expression>& value);
21172  Watch(const Watch& obj);
21173 
21174 
21175  virtual ~Watch() = default;
21176 
21177  /// \}
21178 
21179 
21180 
21181 
21182 
21183 
21184  /**
21185  * \brief Check if the ast node is an instance of ast::Watch
21186  * \return true as object is of type ast::Watch
21187  */
21188  bool is_watch () const noexcept override {
21189  return true;
21190  }
21191 
21192  /**
21193  * \brief Return a copy of the current node
21194  *
21195  * Recursively make a new copy/clone of the current node including
21196  * all members and return a pointer to the node. This is used for
21197  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21198  * ast.
21199  *
21200  * @return pointer to the clone/copy of the current node
21201  */
21202  Watch* clone() const override {
21203  return new Watch(*this);
21204  }
21205 
21206  /// \name Getters
21207  /// \{
21208 
21209  /**
21210  * \brief Return type (ast::AstNodeType) of ast node
21211  *
21212  * Every node in the ast has a type defined in ast::AstNodeType and this
21213  * function is used to retrieve the same.
21214  *
21215  * \return ast node type i.e. ast::AstNodeType::WATCH
21216  *
21217  * \sa Ast::get_node_type_name
21218  */
21219  AstNodeType get_node_type() const noexcept override {
21220  return AstNodeType::WATCH;
21221  }
21222 
21223  /**
21224  * \brief Return type (ast::AstNodeType) of ast node as std::string
21225  *
21226  * Every node in the ast has a type defined in ast::AstNodeType.
21227  * This type name can be returned as a std::string for printing
21228  * node to text/json form.
21229  *
21230  * \return name of the node type as a string i.e. "Watch"
21231  *
21232  * \sa Ast::get_node_name
21233  */
21234  std::string get_node_type_name() const noexcept override {
21235  return "Watch";
21236  }
21237 
21238 
21239  /**
21240  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21241  */
21242  std::shared_ptr<Ast> get_shared_ptr() override {
21243  return std::static_pointer_cast<Watch>(shared_from_this());
21244  }
21245 
21246  /**
21247  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21248  */
21249  std::shared_ptr<const Ast> get_shared_ptr() const override {
21250  return std::static_pointer_cast<const Watch>(shared_from_this());
21251  }
21252 
21253  /**
21254  * \brief Return associated token for the current ast node
21255  *
21256  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
21257  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
21258  * nullptr to store in the nmodl::symtab::SymbolTable.
21259  *
21260  * \return pointer to token if exist otherwise nullptr
21261  */
21262  const ModToken* get_token() const noexcept override {
21263  return token.get();
21264  }
21265 
21266 
21267 
21268 
21269 
21270 
21271 
21272 
21273  /**
21274  * \brief Getter for member variable \ref Watch.expression
21275  */
21276  const std::shared_ptr<Expression>& get_expression() const noexcept {
21277  return expression;
21278  }
21279 
21280 
21281 
21282 
21283 
21284 
21285 
21286  /**
21287  * \brief Getter for member variable \ref Watch.value
21288  */
21289  const std::shared_ptr<Expression>& get_value() const noexcept {
21290  return value;
21291  }
21292 
21293 
21294 
21295  /// \}
21296 
21297  /// \name Setters
21298  /// \{
21299 
21300 
21301  /**
21302  * \brief Set token for the current ast node
21303  */
21304  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
21305 
21306 
21307 
21308 
21309  /**
21310  * \brief Setter for member variable \ref Watch.expression (rvalue reference)
21311  */
21312  void set_expression(std::shared_ptr<Expression>&& expression);
21313 
21314  /**
21315  * \brief Setter for member variable \ref Watch.expression
21316  */
21317  void set_expression(const std::shared_ptr<Expression>& expression);
21318 
21319 
21320  /**
21321  * \brief Setter for member variable \ref Watch.value (rvalue reference)
21322  */
21323  void set_value(std::shared_ptr<Expression>&& value);
21324 
21325  /**
21326  * \brief Setter for member variable \ref Watch.value
21327  */
21328  void set_value(const std::shared_ptr<Expression>& value);
21329 
21330 
21331  /// \}
21332 
21333  /// \name Visitor
21334  /// \{
21335 
21336  /**
21337  * \brief visit children i.e. member variables of current node using provided visitor
21338  *
21339  * Different nodes in the AST have different members (i.e. children). This method
21340  * recursively visits children using provided visitor.
21341  *
21342  * \param v Concrete visitor that will be used to recursively visit children
21343  *
21344  * \sa Ast::visit_children for example.
21345  */
21346  void visit_children(visitor::Visitor& v) override;
21347 
21348  /**
21349  * \brief visit children i.e. member variables of current node using provided visitor
21350  *
21351  * Different nodes in the AST have different members (i.e. children). This method
21352  * recursively visits children using provided visitor.
21353  *
21354  * \param v Concrete constant visitor that will be used to recursively visit children
21355  *
21356  * \sa Ast::visit_children for example.
21357  */
21358  void visit_children(visitor::ConstVisitor& v) const override;
21359 
21360  /**
21361  * \brief accept (or visit) the current AST node using provided visitor
21362  *
21363  * Instead of visiting children of AST node, like Ast::visit_children,
21364  * accept allows to visit the current node itself using provided concrete
21365  * visitor.
21366  *
21367  * \param v Concrete visitor that will be used to recursively visit node
21368  *
21369  * \sa Ast::accept for example.
21370  */
21371  void accept(visitor::Visitor& v) override;
21372 
21373  /**
21374  * \copydoc accept(visitor::Visitor&)
21375  */
21376  void accept(visitor::ConstVisitor& v) const override;
21377 
21378  /// \}
21379 
21380 
21381 
21382  private:
21383  /**
21384  * \brief Set this object as parent for all the children
21385  *
21386  * This should be called in every object (with children) constructor
21387  * to set parents. Since it is called only in the constructors it
21388  * should not be virtual to avoid ambiguities (issue #295).
21389  */
21390  void set_parent_in_children();
21391 };
21392 
21393 /** @} */ // end of ast_class
21394 
21395 
21396 } // namespace ast
21397 } // namespace nmodl
21398 #endif // !NMODL_AST_WATCH_HPP
21399 #ifndef NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
21400 #define NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
21401 
21402 
21403 namespace nmodl {
21404 namespace ast {
21405 
21406 /**
21407  * @addtogroup ast_class
21408  * @ingroup ast
21409  * @{
21410  */
21411 
21412 /**
21413  * \brief TODO
21414  *
21415  *
21416 */
21418  private:
21419  /// TODO
21421  /// token with location information
21422  std::shared_ptr<ModToken> token;
21423 
21424  public:
21425 
21426  /// \name Ctor & dtor
21427  /// \{
21428 
21429  explicit QueueExpressionType(QueueType value);
21431 
21432 
21433  virtual ~QueueExpressionType() = default;
21434 
21435  /// \}
21436 
21437 
21438 
21439 
21440 
21441 
21442  /**
21443  * \brief Check if the ast node is an instance of ast::QueueExpressionType
21444  * \return true as object is of type ast::QueueExpressionType
21445  */
21446  bool is_queue_expression_type () const noexcept override {
21447  return true;
21448  }
21449 
21450  /**
21451  * \brief Return a copy of the current node
21452  *
21453  * Recursively make a new copy/clone of the current node including
21454  * all members and return a pointer to the node. This is used for
21455  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21456  * ast.
21457  *
21458  * @return pointer to the clone/copy of the current node
21459  */
21460  QueueExpressionType* clone() const override {
21461  return new QueueExpressionType(*this);
21462  }
21463 
21464  /// \name Getters
21465  /// \{
21466 
21467  /**
21468  * \brief Return type (ast::AstNodeType) of ast node
21469  *
21470  * Every node in the ast has a type defined in ast::AstNodeType and this
21471  * function is used to retrieve the same.
21472  *
21473  * \return ast node type i.e. ast::AstNodeType::QUEUE_EXPRESSION_TYPE
21474  *
21475  * \sa Ast::get_node_type_name
21476  */
21477  AstNodeType get_node_type() const noexcept override {
21479  }
21480 
21481  /**
21482  * \brief Return type (ast::AstNodeType) of ast node as std::string
21483  *
21484  * Every node in the ast has a type defined in ast::AstNodeType.
21485  * This type name can be returned as a std::string for printing
21486  * node to text/json form.
21487  *
21488  * \return name of the node type as a string i.e. "QueueExpressionType"
21489  *
21490  * \sa Ast::get_node_name
21491  */
21492  std::string get_node_type_name() const noexcept override {
21493  return "QueueExpressionType";
21494  }
21495 
21496 
21497  /**
21498  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21499  */
21500  std::shared_ptr<Ast> get_shared_ptr() override {
21501  return std::static_pointer_cast<QueueExpressionType>(shared_from_this());
21502  }
21503 
21504  /**
21505  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21506  */
21507  std::shared_ptr<const Ast> get_shared_ptr() const override {
21508  return std::static_pointer_cast<const QueueExpressionType>(shared_from_this());
21509  }
21510 
21511  /**
21512  * \brief Return associated token for the current ast node
21513  *
21514  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
21515  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
21516  * nullptr to store in the nmodl::symtab::SymbolTable.
21517  *
21518  * \return pointer to token if exist otherwise nullptr
21519  */
21520  const ModToken* get_token() const noexcept override {
21521  return token.get();
21522  }
21523 
21524 
21525 
21526 
21527 
21528 
21529 
21530 
21531  /**
21532  * \brief Getter for member variable \ref QueueExpressionType.value
21533  */
21534  QueueType get_value() const noexcept {
21535  return value;
21536  }
21537 
21538 
21539 
21540  /// \}
21541 
21542  /// \name Setters
21543  /// \{
21544 
21545 
21546  /**
21547  * \brief Set token for the current ast node
21548  */
21549  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
21550 
21551 
21552 
21553 
21554  /**
21555  * \brief Setter for member variable \ref QueueExpressionType.value
21556  */
21557  void set_value(QueueType value);
21558 
21559 
21560  /// \}
21561 
21562  /// \name Visitor
21563  /// \{
21564 
21565  /**
21566  * \brief visit children i.e. member variables of current node using provided visitor
21567  *
21568  * Different nodes in the AST have different members (i.e. children). This method
21569  * recursively visits children using provided visitor.
21570  *
21571  * \param v Concrete visitor that will be used to recursively visit children
21572  *
21573  * \sa Ast::visit_children for example.
21574  */
21575  void visit_children(visitor::Visitor& v) override;
21576 
21577  /**
21578  * \brief visit children i.e. member variables of current node using provided visitor
21579  *
21580  * Different nodes in the AST have different members (i.e. children). This method
21581  * recursively visits children using provided visitor.
21582  *
21583  * \param v Concrete constant visitor that will be used to recursively visit children
21584  *
21585  * \sa Ast::visit_children for example.
21586  */
21587  void visit_children(visitor::ConstVisitor& v) const override;
21588 
21589  /**
21590  * \brief accept (or visit) the current AST node using provided visitor
21591  *
21592  * Instead of visiting children of AST node, like Ast::visit_children,
21593  * accept allows to visit the current node itself using provided concrete
21594  * visitor.
21595  *
21596  * \param v Concrete visitor that will be used to recursively visit node
21597  *
21598  * \sa Ast::accept for example.
21599  */
21600  void accept(visitor::Visitor& v) override;
21601 
21602  /**
21603  * \copydoc accept(visitor::Visitor&)
21604  */
21605  void accept(visitor::ConstVisitor& v) const override;
21606 
21607  /// \}
21608 
21609 
21610  /**
21611  * \brief Return enum value in string form
21612  *
21613  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
21614  * string representation when they are converted from AST back to
21615  * NMODL. This method is used to return corresponding string representation.
21616  */
21617  std::string eval() const {
21618  return QueueTypeNames[value];
21619  }
21620 
21621 
21622  private:
21623  /**
21624  * \brief Set this object as parent for all the children
21625  *
21626  * This should be called in every object (with children) constructor
21627  * to set parents. Since it is called only in the constructors it
21628  * should not be virtual to avoid ambiguities (issue #295).
21629  */
21630  void set_parent_in_children();
21631 };
21632 
21633 /** @} */ // end of ast_class
21634 
21635 
21636 } // namespace ast
21637 } // namespace nmodl
21638 #endif // !NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
21639 #ifndef NMODL_AST_MATCH_HPP
21640 #define NMODL_AST_MATCH_HPP
21641 
21642 
21643 namespace nmodl {
21644 namespace ast {
21645 
21646 /**
21647  * @addtogroup ast_class
21648  * @ingroup ast
21649  * @{
21650  */
21651 
21652 /**
21653  * \brief TODO
21654  *
21655  *
21656 */
21657 class Match : public Expression {
21658  private:
21659  /// TODO
21660  std::shared_ptr<Identifier> name;
21661  /// TODO
21662  std::shared_ptr<Expression> expression;
21663  /// token with location information
21664  std::shared_ptr<ModToken> token;
21665 
21666  public:
21667 
21668  /// \name Ctor & dtor
21669  /// \{
21670 
21671  explicit Match(Identifier* name, Expression* expression);
21672  explicit Match(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Expression>& expression);
21673  Match(const Match& obj);
21674 
21675 
21676  virtual ~Match() = default;
21677 
21678  /// \}
21679 
21680 
21681 
21682 
21683 
21684 
21685  /**
21686  * \brief Check if the ast node is an instance of ast::Match
21687  * \return true as object is of type ast::Match
21688  */
21689  bool is_match () const noexcept override {
21690  return true;
21691  }
21692 
21693  /**
21694  * \brief Return a copy of the current node
21695  *
21696  * Recursively make a new copy/clone of the current node including
21697  * all members and return a pointer to the node. This is used for
21698  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21699  * ast.
21700  *
21701  * @return pointer to the clone/copy of the current node
21702  */
21703  Match* clone() const override {
21704  return new Match(*this);
21705  }
21706 
21707  /// \name Getters
21708  /// \{
21709 
21710  /**
21711  * \brief Return type (ast::AstNodeType) of ast node
21712  *
21713  * Every node in the ast has a type defined in ast::AstNodeType and this
21714  * function is used to retrieve the same.
21715  *
21716  * \return ast node type i.e. ast::AstNodeType::MATCH
21717  *
21718  * \sa Ast::get_node_type_name
21719  */
21720  AstNodeType get_node_type() const noexcept override {
21721  return AstNodeType::MATCH;
21722  }
21723 
21724  /**
21725  * \brief Return type (ast::AstNodeType) of ast node as std::string
21726  *
21727  * Every node in the ast has a type defined in ast::AstNodeType.
21728  * This type name can be returned as a std::string for printing
21729  * node to text/json form.
21730  *
21731  * \return name of the node type as a string i.e. "Match"
21732  *
21733  * \sa Ast::get_node_name
21734  */
21735  std::string get_node_type_name() const noexcept override {
21736  return "Match";
21737  }
21738 
21739 
21740  /**
21741  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21742  */
21743  std::shared_ptr<Ast> get_shared_ptr() override {
21744  return std::static_pointer_cast<Match>(shared_from_this());
21745  }
21746 
21747  /**
21748  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21749  */
21750  std::shared_ptr<const Ast> get_shared_ptr() const override {
21751  return std::static_pointer_cast<const Match>(shared_from_this());
21752  }
21753 
21754  /**
21755  * \brief Return associated token for the current ast node
21756  *
21757  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
21758  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
21759  * nullptr to store in the nmodl::symtab::SymbolTable.
21760  *
21761  * \return pointer to token if exist otherwise nullptr
21762  */
21763  const ModToken* get_token() const noexcept override {
21764  return token.get();
21765  }
21766 
21767 
21768 
21769 
21770 
21771 
21772 
21773 
21774  /**
21775  * \brief Getter for member variable \ref Match.name
21776  */
21777  const std::shared_ptr<Identifier>& get_name() const noexcept {
21778  return name;
21779  }
21780 
21781 
21782 
21783 
21784 
21785 
21786 
21787  /**
21788  * \brief Getter for member variable \ref Match.expression
21789  */
21790  const std::shared_ptr<Expression>& get_expression() const noexcept {
21791  return expression;
21792  }
21793 
21794 
21795 
21796  /// \}
21797 
21798  /// \name Setters
21799  /// \{
21800 
21801 
21802  /**
21803  * \brief Set token for the current ast node
21804  */
21805  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
21806 
21807 
21808 
21809 
21810  /**
21811  * \brief Setter for member variable \ref Match.name (rvalue reference)
21812  */
21813  void set_name(std::shared_ptr<Identifier>&& name);
21814 
21815  /**
21816  * \brief Setter for member variable \ref Match.name
21817  */
21818  void set_name(const std::shared_ptr<Identifier>& name);
21819 
21820 
21821  /**
21822  * \brief Setter for member variable \ref Match.expression (rvalue reference)
21823  */
21824  void set_expression(std::shared_ptr<Expression>&& expression);
21825 
21826  /**
21827  * \brief Setter for member variable \ref Match.expression
21828  */
21829  void set_expression(const std::shared_ptr<Expression>& expression);
21830 
21831 
21832  /// \}
21833 
21834  /// \name Visitor
21835  /// \{
21836 
21837  /**
21838  * \brief visit children i.e. member variables of current node using provided visitor
21839  *
21840  * Different nodes in the AST have different members (i.e. children). This method
21841  * recursively visits children using provided visitor.
21842  *
21843  * \param v Concrete visitor that will be used to recursively visit children
21844  *
21845  * \sa Ast::visit_children for example.
21846  */
21847  void visit_children(visitor::Visitor& v) override;
21848 
21849  /**
21850  * \brief visit children i.e. member variables of current node using provided visitor
21851  *
21852  * Different nodes in the AST have different members (i.e. children). This method
21853  * recursively visits children using provided visitor.
21854  *
21855  * \param v Concrete constant visitor that will be used to recursively visit children
21856  *
21857  * \sa Ast::visit_children for example.
21858  */
21859  void visit_children(visitor::ConstVisitor& v) const override;
21860 
21861  /**
21862  * \brief accept (or visit) the current AST node using provided visitor
21863  *
21864  * Instead of visiting children of AST node, like Ast::visit_children,
21865  * accept allows to visit the current node itself using provided concrete
21866  * visitor.
21867  *
21868  * \param v Concrete visitor that will be used to recursively visit node
21869  *
21870  * \sa Ast::accept for example.
21871  */
21872  void accept(visitor::Visitor& v) override;
21873 
21874  /**
21875  * \copydoc accept(visitor::Visitor&)
21876  */
21877  void accept(visitor::ConstVisitor& v) const override;
21878 
21879  /// \}
21880 
21881 
21882 
21883  private:
21884  /**
21885  * \brief Set this object as parent for all the children
21886  *
21887  * This should be called in every object (with children) constructor
21888  * to set parents. Since it is called only in the constructors it
21889  * should not be virtual to avoid ambiguities (issue #295).
21890  */
21891  void set_parent_in_children();
21892 };
21893 
21894 /** @} */ // end of ast_class
21895 
21896 
21897 } // namespace ast
21898 } // namespace nmodl
21899 #endif // !NMODL_AST_MATCH_HPP
21900 #ifndef NMODL_AST_BA_BLOCK_TYPE_HPP
21901 #define NMODL_AST_BA_BLOCK_TYPE_HPP
21902 
21903 
21904 namespace nmodl {
21905 namespace ast {
21906 
21907 /**
21908  * @addtogroup ast_class
21909  * @ingroup ast
21910  * @{
21911  */
21912 
21913 /**
21914  * \brief Type to represent different block types for before/after block
21915  *
21916  * Different NMODL blocks can be used with ast::BeforeBlock and ast::AfterBlock.
21917  * This type is used to represent such block types.
21918  *
21919  * \sa ast::BeforeBlock as::AfterBlock
21920  *
21921 */
21922 class BABlockType : public Expression {
21923  private:
21924  /// block type
21926  /// token with location information
21927  std::shared_ptr<ModToken> token;
21928 
21929  public:
21930 
21931  /// \name Ctor & dtor
21932  /// \{
21933 
21934  explicit BABlockType(BAType value);
21935  BABlockType(const BABlockType& obj);
21936 
21937 
21938  virtual ~BABlockType() = default;
21939 
21940  /// \}
21941 
21942 
21943 
21944 
21945 
21946 
21947  /**
21948  * \brief Check if the ast node is an instance of ast::BABlockType
21949  * \return true as object is of type ast::BABlockType
21950  */
21951  bool is_ba_block_type () const noexcept override {
21952  return true;
21953  }
21954 
21955  /**
21956  * \brief Return a copy of the current node
21957  *
21958  * Recursively make a new copy/clone of the current node including
21959  * all members and return a pointer to the node. This is used for
21960  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21961  * ast.
21962  *
21963  * @return pointer to the clone/copy of the current node
21964  */
21965  BABlockType* clone() const override {
21966  return new BABlockType(*this);
21967  }
21968 
21969  /// \name Getters
21970  /// \{
21971 
21972  /**
21973  * \brief Return type (ast::AstNodeType) of ast node
21974  *
21975  * Every node in the ast has a type defined in ast::AstNodeType and this
21976  * function is used to retrieve the same.
21977  *
21978  * \return ast node type i.e. ast::AstNodeType::BA_BLOCK_TYPE
21979  *
21980  * \sa Ast::get_node_type_name
21981  */
21982  AstNodeType get_node_type() const noexcept override {
21984  }
21985 
21986  /**
21987  * \brief Return type (ast::AstNodeType) of ast node as std::string
21988  *
21989  * Every node in the ast has a type defined in ast::AstNodeType.
21990  * This type name can be returned as a std::string for printing
21991  * node to text/json form.
21992  *
21993  * \return name of the node type as a string i.e. "BABlockType"
21994  *
21995  * \sa Ast::get_node_name
21996  */
21997  std::string get_node_type_name() const noexcept override {
21998  return "BABlockType";
21999  }
22000 
22001 
22002  /**
22003  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22004  */
22005  std::shared_ptr<Ast> get_shared_ptr() override {
22006  return std::static_pointer_cast<BABlockType>(shared_from_this());
22007  }
22008 
22009  /**
22010  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22011  */
22012  std::shared_ptr<const Ast> get_shared_ptr() const override {
22013  return std::static_pointer_cast<const BABlockType>(shared_from_this());
22014  }
22015 
22016  /**
22017  * \brief Return associated token for the current ast node
22018  *
22019  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
22020  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
22021  * nullptr to store in the nmodl::symtab::SymbolTable.
22022  *
22023  * \return pointer to token if exist otherwise nullptr
22024  */
22025  const ModToken* get_token() const noexcept override {
22026  return token.get();
22027  }
22028 
22029 
22030 
22031 
22032 
22033 
22034 
22035 
22036  /**
22037  * \brief Getter for member variable \ref BABlockType.value
22038  */
22039  BAType get_value() const noexcept {
22040  return value;
22041  }
22042 
22043 
22044 
22045  /// \}
22046 
22047  /// \name Setters
22048  /// \{
22049 
22050 
22051  /**
22052  * \brief Set token for the current ast node
22053  */
22054  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
22055 
22056 
22057 
22058 
22059  /**
22060  * \brief Setter for member variable \ref BABlockType.value
22061  */
22062  void set_value(BAType value);
22063 
22064 
22065  /// \}
22066 
22067  /// \name Visitor
22068  /// \{
22069 
22070  /**
22071  * \brief visit children i.e. member variables of current node using provided visitor
22072  *
22073  * Different nodes in the AST have different members (i.e. children). This method
22074  * recursively visits children using provided visitor.
22075  *
22076  * \param v Concrete visitor that will be used to recursively visit children
22077  *
22078  * \sa Ast::visit_children for example.
22079  */
22080  void visit_children(visitor::Visitor& v) override;
22081 
22082  /**
22083  * \brief visit children i.e. member variables of current node using provided visitor
22084  *
22085  * Different nodes in the AST have different members (i.e. children). This method
22086  * recursively visits children using provided visitor.
22087  *
22088  * \param v Concrete constant visitor that will be used to recursively visit children
22089  *
22090  * \sa Ast::visit_children for example.
22091  */
22092  void visit_children(visitor::ConstVisitor& v) const override;
22093 
22094  /**
22095  * \brief accept (or visit) the current AST node using provided visitor
22096  *
22097  * Instead of visiting children of AST node, like Ast::visit_children,
22098  * accept allows to visit the current node itself using provided concrete
22099  * visitor.
22100  *
22101  * \param v Concrete visitor that will be used to recursively visit node
22102  *
22103  * \sa Ast::accept for example.
22104  */
22105  void accept(visitor::Visitor& v) override;
22106 
22107  /**
22108  * \copydoc accept(visitor::Visitor&)
22109  */
22110  void accept(visitor::ConstVisitor& v) const override;
22111 
22112  /// \}
22113 
22114 
22115  /**
22116  * \brief Return enum value in string form
22117  *
22118  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
22119  * string representation when they are converted from AST back to
22120  * NMODL. This method is used to return corresponding string representation.
22121  */
22122  std::string eval() const {
22123  return BATypeNames[value];
22124  }
22125 
22126 
22127  private:
22128  /**
22129  * \brief Set this object as parent for all the children
22130  *
22131  * This should be called in every object (with children) constructor
22132  * to set parents. Since it is called only in the constructors it
22133  * should not be virtual to avoid ambiguities (issue #295).
22134  */
22135  void set_parent_in_children();
22136 };
22137 
22138 /** @} */ // end of ast_class
22139 
22140 
22141 } // namespace ast
22142 } // namespace nmodl
22143 #endif // !NMODL_AST_BA_BLOCK_TYPE_HPP
22144 #ifndef NMODL_AST_UNIT_DEF_HPP
22145 #define NMODL_AST_UNIT_DEF_HPP
22146 
22147 
22148 namespace nmodl {
22149 namespace ast {
22150 
22151 /**
22152  * @addtogroup ast_class
22153  * @ingroup ast
22154  * @{
22155  */
22156 
22157 /**
22158  * \brief TODO
22159  *
22160  *
22161 */
22162 class UnitDef : public Expression {
22163  private:
22164  /// TODO
22165  std::shared_ptr<Unit> unit1;
22166  /// TODO
22167  std::shared_ptr<Unit> unit2;
22168  /// token with location information
22169  std::shared_ptr<ModToken> token;
22170 
22171  public:
22172 
22173  /// \name Ctor & dtor
22174  /// \{
22175 
22176  explicit UnitDef(Unit* unit1, Unit* unit2);
22177  explicit UnitDef(const std::shared_ptr<Unit>& unit1, const std::shared_ptr<Unit>& unit2);
22178  UnitDef(const UnitDef& obj);
22179 
22180 
22181  virtual ~UnitDef() = default;
22182 
22183  /// \}
22184 
22185 
22186 
22187 
22188 
22189 
22190  /**
22191  * \brief Check if the ast node is an instance of ast::UnitDef
22192  * \return true as object is of type ast::UnitDef
22193  */
22194  bool is_unit_def () const noexcept override {
22195  return true;
22196  }
22197 
22198  /**
22199  * \brief Return a copy of the current node
22200  *
22201  * Recursively make a new copy/clone of the current node including
22202  * all members and return a pointer to the node. This is used for
22203  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22204  * ast.
22205  *
22206  * @return pointer to the clone/copy of the current node
22207  */
22208  UnitDef* clone() const override {
22209  return new UnitDef(*this);
22210  }
22211 
22212  /// \name Getters
22213  /// \{
22214 
22215  /**
22216  * \brief Return type (ast::AstNodeType) of ast node
22217  *
22218  * Every node in the ast has a type defined in ast::AstNodeType and this
22219  * function is used to retrieve the same.
22220  *
22221  * \return ast node type i.e. ast::AstNodeType::UNIT_DEF
22222  *
22223  * \sa Ast::get_node_type_name
22224  */
22225  AstNodeType get_node_type() const noexcept override {
22226  return AstNodeType::UNIT_DEF;
22227  }
22228 
22229  /**
22230  * \brief Return type (ast::AstNodeType) of ast node as std::string
22231  *
22232  * Every node in the ast has a type defined in ast::AstNodeType.
22233  * This type name can be returned as a std::string for printing
22234  * node to text/json form.
22235  *
22236  * \return name of the node type as a string i.e. "UnitDef"
22237  *
22238  * \sa Ast::get_node_name
22239  */
22240  std::string get_node_type_name() const noexcept override {
22241  return "UnitDef";
22242  }
22243 
22244 
22245  /**
22246  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22247  */
22248  std::shared_ptr<Ast> get_shared_ptr() override {
22249  return std::static_pointer_cast<UnitDef>(shared_from_this());
22250  }
22251 
22252  /**
22253  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22254  */
22255  std::shared_ptr<const Ast> get_shared_ptr() const override {
22256  return std::static_pointer_cast<const UnitDef>(shared_from_this());
22257  }
22258 
22259  /**
22260  * \brief Return associated token for the current ast node
22261  *
22262  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
22263  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
22264  * nullptr to store in the nmodl::symtab::SymbolTable.
22265  *
22266  * \return pointer to token if exist otherwise nullptr
22267  */
22268  const ModToken* get_token() const noexcept override {
22269  return token.get();
22270  }
22271 
22272 
22273 
22274 
22275 
22276 
22277 /**
22278  * \brief Return name of the node
22279  *
22280  * Some ast nodes have a member marked designated as node name. For example,
22281  * in case of this ast::Unit has unit1 designated as a
22282  * node name.
22283  *
22284  * @return name of the node as std::string
22285  *
22286  * \sa Ast::get_node_type_name
22287  */
22288 std::string get_node_name() const override;
22289 
22290 
22291  /**
22292  * \brief Getter for member variable \ref UnitDef.unit1
22293  */
22294  const std::shared_ptr<Unit>& get_unit1() const noexcept {
22295  return unit1;
22296  }
22297 
22298 
22299 
22300 
22301 
22302 
22303 
22304  /**
22305  * \brief Getter for member variable \ref UnitDef.unit2
22306  */
22307  const std::shared_ptr<Unit>& get_unit2() const noexcept {
22308  return unit2;
22309  }
22310 
22311 
22312 
22313  /// \}
22314 
22315  /// \name Setters
22316  /// \{
22317 
22318 
22319  /**
22320  * \brief Set token for the current ast node
22321  */
22322  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
22323 
22324 
22325 
22326 
22327  /**
22328  * \brief Setter for member variable \ref UnitDef.unit1 (rvalue reference)
22329  */
22330  void set_unit1(std::shared_ptr<Unit>&& unit1);
22331 
22332  /**
22333  * \brief Setter for member variable \ref UnitDef.unit1
22334  */
22335  void set_unit1(const std::shared_ptr<Unit>& unit1);
22336 
22337 
22338  /**
22339  * \brief Setter for member variable \ref UnitDef.unit2 (rvalue reference)
22340  */
22341  void set_unit2(std::shared_ptr<Unit>&& unit2);
22342 
22343  /**
22344  * \brief Setter for member variable \ref UnitDef.unit2
22345  */
22346  void set_unit2(const std::shared_ptr<Unit>& unit2);
22347 
22348 
22349  /// \}
22350 
22351  /// \name Visitor
22352  /// \{
22353 
22354  /**
22355  * \brief visit children i.e. member variables of current node using provided visitor
22356  *
22357  * Different nodes in the AST have different members (i.e. children). This method
22358  * recursively visits children using provided visitor.
22359  *
22360  * \param v Concrete visitor that will be used to recursively visit children
22361  *
22362  * \sa Ast::visit_children for example.
22363  */
22364  void visit_children(visitor::Visitor& v) override;
22365 
22366  /**
22367  * \brief visit children i.e. member variables of current node using provided visitor
22368  *
22369  * Different nodes in the AST have different members (i.e. children). This method
22370  * recursively visits children using provided visitor.
22371  *
22372  * \param v Concrete constant visitor that will be used to recursively visit children
22373  *
22374  * \sa Ast::visit_children for example.
22375  */
22376  void visit_children(visitor::ConstVisitor& v) const override;
22377 
22378  /**
22379  * \brief accept (or visit) the current AST node using provided visitor
22380  *
22381  * Instead of visiting children of AST node, like Ast::visit_children,
22382  * accept allows to visit the current node itself using provided concrete
22383  * visitor.
22384  *
22385  * \param v Concrete visitor that will be used to recursively visit node
22386  *
22387  * \sa Ast::accept for example.
22388  */
22389  void accept(visitor::Visitor& v) override;
22390 
22391  /**
22392  * \copydoc accept(visitor::Visitor&)
22393  */
22394  void accept(visitor::ConstVisitor& v) const override;
22395 
22396  /// \}
22397 
22398 
22399 
22400  private:
22401  /**
22402  * \brief Set this object as parent for all the children
22403  *
22404  * This should be called in every object (with children) constructor
22405  * to set parents. Since it is called only in the constructors it
22406  * should not be virtual to avoid ambiguities (issue #295).
22407  */
22408  void set_parent_in_children();
22409 };
22410 
22411 /** @} */ // end of ast_class
22412 
22413 
22414 } // namespace ast
22415 } // namespace nmodl
22416 #endif // !NMODL_AST_UNIT_DEF_HPP
22417 #ifndef NMODL_AST_FACTOR_DEF_HPP
22418 #define NMODL_AST_FACTOR_DEF_HPP
22419 
22420 
22421 namespace nmodl {
22422 namespace ast {
22423 
22424 /**
22425  * @addtogroup ast_class
22426  * @ingroup ast
22427  * @{
22428  */
22429 
22430 /**
22431  * \brief TODO
22432  *
22433  *
22434 */
22435 class FactorDef : public Expression {
22436  private:
22437  /// TODO
22438  std::shared_ptr<Name> name;
22439  /// TODO
22440  std::shared_ptr<Double> value;
22441  /// TODO
22442  std::shared_ptr<Unit> unit1;
22443  /// Todo: Michael : rename variable gt as well
22444  std::shared_ptr<Boolean> gt;
22445  /// TODO
22446  std::shared_ptr<Unit> unit2;
22447  /// token with location information
22448  std::shared_ptr<ModToken> token;
22449 
22450  public:
22451 
22452  /// \name Ctor & dtor
22453  /// \{
22454 
22455  explicit FactorDef(Name* name, Double* value, Unit* unit1, Boolean* gt, Unit* unit2);
22456  explicit FactorDef(const std::shared_ptr<Name>& name, const std::shared_ptr<Double>& value, const std::shared_ptr<Unit>& unit1, const std::shared_ptr<Boolean>& gt, const std::shared_ptr<Unit>& unit2);
22457  FactorDef(const FactorDef& obj);
22458 
22459  FactorDef() = default;
22460 
22461  virtual ~FactorDef() = default;
22462 
22463  /// \}
22464 
22465 
22466 
22467 
22468 
22469 
22470  /**
22471  * \brief Check if the ast node is an instance of ast::FactorDef
22472  * \return true as object is of type ast::FactorDef
22473  */
22474  bool is_factor_def () const noexcept override {
22475  return true;
22476  }
22477 
22478  /**
22479  * \brief Return a copy of the current node
22480  *
22481  * Recursively make a new copy/clone of the current node including
22482  * all members and return a pointer to the node. This is used for
22483  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22484  * ast.
22485  *
22486  * @return pointer to the clone/copy of the current node
22487  */
22488  FactorDef* clone() const override {
22489  return new FactorDef(*this);
22490  }
22491 
22492  /// \name Getters
22493  /// \{
22494 
22495  /**
22496  * \brief Return type (ast::AstNodeType) of ast node
22497  *
22498  * Every node in the ast has a type defined in ast::AstNodeType and this
22499  * function is used to retrieve the same.
22500  *
22501  * \return ast node type i.e. ast::AstNodeType::FACTOR_DEF
22502  *
22503  * \sa Ast::get_node_type_name
22504  */
22505  AstNodeType get_node_type() const noexcept override {
22506  return AstNodeType::FACTOR_DEF;
22507  }
22508 
22509  /**
22510  * \brief Return type (ast::AstNodeType) of ast node as std::string
22511  *
22512  * Every node in the ast has a type defined in ast::AstNodeType.
22513  * This type name can be returned as a std::string for printing
22514  * node to text/json form.
22515  *
22516  * \return name of the node type as a string i.e. "FactorDef"
22517  *
22518  * \sa Ast::get_node_name
22519  */
22520  std::string get_node_type_name() const noexcept override {
22521  return "FactorDef";
22522  }
22523 
22524 
22525  /**
22526  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22527  */
22528  std::shared_ptr<Ast> get_shared_ptr() override {
22529  return std::static_pointer_cast<FactorDef>(shared_from_this());
22530  }
22531 
22532  /**
22533  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22534  */
22535  std::shared_ptr<const Ast> get_shared_ptr() const override {
22536  return std::static_pointer_cast<const FactorDef>(shared_from_this());
22537  }
22538 
22539  /**
22540  * \brief Return associated token for the current ast node
22541  *
22542  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
22543  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
22544  * nullptr to store in the nmodl::symtab::SymbolTable.
22545  *
22546  * \return pointer to token if exist otherwise nullptr
22547  */
22548  const ModToken* get_token() const noexcept override {
22549  return token.get();
22550  }
22551 
22552 
22553 
22554 
22555 
22556 
22557 /**
22558  * \brief Return name of the node
22559  *
22560  * Some ast nodes have a member marked designated as node name. For example,
22561  * in case of this ast::Name has name designated as a
22562  * node name.
22563  *
22564  * @return name of the node as std::string
22565  *
22566  * \sa Ast::get_node_type_name
22567  */
22568 std::string get_node_name() const override;
22569 
22570 
22571  /**
22572  * \brief Getter for member variable \ref FactorDef.name
22573  */
22574  const std::shared_ptr<Name>& get_name() const noexcept {
22575  return name;
22576  }
22577 
22578 
22579 
22580 
22581 
22582 
22583 
22584  /**
22585  * \brief Getter for member variable \ref FactorDef.value
22586  */
22587  const std::shared_ptr<Double>& get_value() const noexcept {
22588  return value;
22589  }
22590 
22591 
22592 
22593 
22594 
22595 
22596 
22597  /**
22598  * \brief Getter for member variable \ref FactorDef.unit1
22599  */
22600  const std::shared_ptr<Unit>& get_unit1() const noexcept {
22601  return unit1;
22602  }
22603 
22604 
22605 
22606 
22607 
22608 
22609 
22610  /**
22611  * \brief Getter for member variable \ref FactorDef.gt
22612  */
22613  const std::shared_ptr<Boolean>& get_gt() const noexcept {
22614  return gt;
22615  }
22616 
22617 
22618 
22619 
22620 
22621 
22622 
22623  /**
22624  * \brief Getter for member variable \ref FactorDef.unit2
22625  */
22626  const std::shared_ptr<Unit>& get_unit2() const noexcept {
22627  return unit2;
22628  }
22629 
22630 
22631 
22632  /// \}
22633 
22634  /// \name Setters
22635  /// \{
22636 
22637 
22638  /**
22639  * \brief Set token for the current ast node
22640  */
22641  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
22642 
22643 
22644 
22645 
22646  /**
22647  * \brief Setter for member variable \ref FactorDef.name (rvalue reference)
22648  */
22649  void set_name(std::shared_ptr<Name>&& name);
22650 
22651  /**
22652  * \brief Setter for member variable \ref FactorDef.name
22653  */
22654  void set_name(const std::shared_ptr<Name>& name);
22655 
22656 
22657  /**
22658  * \brief Setter for member variable \ref FactorDef.value (rvalue reference)
22659  */
22660  void set_value(std::shared_ptr<Double>&& value);
22661 
22662  /**
22663  * \brief Setter for member variable \ref FactorDef.value
22664  */
22665  void set_value(const std::shared_ptr<Double>& value);
22666 
22667 
22668  /**
22669  * \brief Setter for member variable \ref FactorDef.unit1 (rvalue reference)
22670  */
22671  void set_unit1(std::shared_ptr<Unit>&& unit1);
22672 
22673  /**
22674  * \brief Setter for member variable \ref FactorDef.unit1
22675  */
22676  void set_unit1(const std::shared_ptr<Unit>& unit1);
22677 
22678 
22679  /**
22680  * \brief Setter for member variable \ref FactorDef.gt (rvalue reference)
22681  */
22682  void set_gt(std::shared_ptr<Boolean>&& gt);
22683 
22684  /**
22685  * \brief Setter for member variable \ref FactorDef.gt
22686  */
22687  void set_gt(const std::shared_ptr<Boolean>& gt);
22688 
22689 
22690  /**
22691  * \brief Setter for member variable \ref FactorDef.unit2 (rvalue reference)
22692  */
22693  void set_unit2(std::shared_ptr<Unit>&& unit2);
22694 
22695  /**
22696  * \brief Setter for member variable \ref FactorDef.unit2
22697  */
22698  void set_unit2(const std::shared_ptr<Unit>& unit2);
22699 
22700 
22701  /// \}
22702 
22703  /// \name Visitor
22704  /// \{
22705 
22706  /**
22707  * \brief visit children i.e. member variables of current node using provided visitor
22708  *
22709  * Different nodes in the AST have different members (i.e. children). This method
22710  * recursively visits children using provided visitor.
22711  *
22712  * \param v Concrete visitor that will be used to recursively visit children
22713  *
22714  * \sa Ast::visit_children for example.
22715  */
22716  void visit_children(visitor::Visitor& v) override;
22717 
22718  /**
22719  * \brief visit children i.e. member variables of current node using provided visitor
22720  *
22721  * Different nodes in the AST have different members (i.e. children). This method
22722  * recursively visits children using provided visitor.
22723  *
22724  * \param v Concrete constant visitor that will be used to recursively visit children
22725  *
22726  * \sa Ast::visit_children for example.
22727  */
22728  void visit_children(visitor::ConstVisitor& v) const override;
22729 
22730  /**
22731  * \brief accept (or visit) the current AST node using provided visitor
22732  *
22733  * Instead of visiting children of AST node, like Ast::visit_children,
22734  * accept allows to visit the current node itself using provided concrete
22735  * visitor.
22736  *
22737  * \param v Concrete visitor that will be used to recursively visit node
22738  *
22739  * \sa Ast::accept for example.
22740  */
22741  void accept(visitor::Visitor& v) override;
22742 
22743  /**
22744  * \copydoc accept(visitor::Visitor&)
22745  */
22746  void accept(visitor::ConstVisitor& v) const override;
22747 
22748  /// \}
22749 
22750 
22751 
22752  private:
22753  /**
22754  * \brief Set this object as parent for all the children
22755  *
22756  * This should be called in every object (with children) constructor
22757  * to set parents. Since it is called only in the constructors it
22758  * should not be virtual to avoid ambiguities (issue #295).
22759  */
22760  void set_parent_in_children();
22761 };
22762 
22763 /** @} */ // end of ast_class
22764 
22765 
22766 } // namespace ast
22767 } // namespace nmodl
22768 #endif // !NMODL_AST_FACTOR_DEF_HPP
22769 #ifndef NMODL_AST_VALENCE_HPP
22770 #define NMODL_AST_VALENCE_HPP
22771 
22772 
22773 namespace nmodl {
22774 namespace ast {
22775 
22776 /**
22777  * @addtogroup ast_class
22778  * @ingroup ast
22779  * @{
22780  */
22781 
22782 /**
22783  * \brief TODO
22784  *
22785  *
22786 */
22787 class Valence : public Expression {
22788  private:
22789  /// TODO
22790  std::shared_ptr<Name> type;
22791  /// TODO
22792  std::shared_ptr<Double> value;
22793  /// token with location information
22794  std::shared_ptr<ModToken> token;
22795 
22796  public:
22797 
22798  /// \name Ctor & dtor
22799  /// \{
22800 
22801  explicit Valence(Name* type, Double* value);
22802  explicit Valence(const std::shared_ptr<Name>& type, const std::shared_ptr<Double>& value);
22803  Valence(const Valence& obj);
22804 
22805 
22806  virtual ~Valence() = default;
22807 
22808  /// \}
22809 
22810 
22811 
22812 
22813 
22814 
22815  /**
22816  * \brief Check if the ast node is an instance of ast::Valence
22817  * \return true as object is of type ast::Valence
22818  */
22819  bool is_valence () const noexcept override {
22820  return true;
22821  }
22822 
22823  /**
22824  * \brief Return a copy of the current node
22825  *
22826  * Recursively make a new copy/clone of the current node including
22827  * all members and return a pointer to the node. This is used for
22828  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22829  * ast.
22830  *
22831  * @return pointer to the clone/copy of the current node
22832  */
22833  Valence* clone() const override {
22834  return new Valence(*this);
22835  }
22836 
22837  /// \name Getters
22838  /// \{
22839 
22840  /**
22841  * \brief Return type (ast::AstNodeType) of ast node
22842  *
22843  * Every node in the ast has a type defined in ast::AstNodeType and this
22844  * function is used to retrieve the same.
22845  *
22846  * \return ast node type i.e. ast::AstNodeType::VALENCE
22847  *
22848  * \sa Ast::get_node_type_name
22849  */
22850  AstNodeType get_node_type() const noexcept override {
22851  return AstNodeType::VALENCE;
22852  }
22853 
22854  /**
22855  * \brief Return type (ast::AstNodeType) of ast node as std::string
22856  *
22857  * Every node in the ast has a type defined in ast::AstNodeType.
22858  * This type name can be returned as a std::string for printing
22859  * node to text/json form.
22860  *
22861  * \return name of the node type as a string i.e. "Valence"
22862  *
22863  * \sa Ast::get_node_name
22864  */
22865  std::string get_node_type_name() const noexcept override {
22866  return "Valence";
22867  }
22868 
22869 
22870  /**
22871  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22872  */
22873  std::shared_ptr<Ast> get_shared_ptr() override {
22874  return std::static_pointer_cast<Valence>(shared_from_this());
22875  }
22876 
22877  /**
22878  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22879  */
22880  std::shared_ptr<const Ast> get_shared_ptr() const override {
22881  return std::static_pointer_cast<const Valence>(shared_from_this());
22882  }
22883 
22884  /**
22885  * \brief Return associated token for the current ast node
22886  *
22887  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
22888  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
22889  * nullptr to store in the nmodl::symtab::SymbolTable.
22890  *
22891  * \return pointer to token if exist otherwise nullptr
22892  */
22893  const ModToken* get_token() const noexcept override {
22894  return token.get();
22895  }
22896 
22897 
22898 
22899 
22900 
22901 
22902 
22903 
22904  /**
22905  * \brief Getter for member variable \ref Valence.type
22906  */
22907  const std::shared_ptr<Name>& get_type() const noexcept {
22908  return type;
22909  }
22910 
22911 
22912 
22913 
22914 
22915 
22916 
22917  /**
22918  * \brief Getter for member variable \ref Valence.value
22919  */
22920  const std::shared_ptr<Double>& get_value() const noexcept {
22921  return value;
22922  }
22923 
22924 
22925 
22926  /// \}
22927 
22928  /// \name Setters
22929  /// \{
22930 
22931 
22932  /**
22933  * \brief Set token for the current ast node
22934  */
22935  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
22936 
22937 
22938 
22939 
22940  /**
22941  * \brief Setter for member variable \ref Valence.type (rvalue reference)
22942  */
22943  void set_type(std::shared_ptr<Name>&& type);
22944 
22945  /**
22946  * \brief Setter for member variable \ref Valence.type
22947  */
22948  void set_type(const std::shared_ptr<Name>& type);
22949 
22950 
22951  /**
22952  * \brief Setter for member variable \ref Valence.value (rvalue reference)
22953  */
22954  void set_value(std::shared_ptr<Double>&& value);
22955 
22956  /**
22957  * \brief Setter for member variable \ref Valence.value
22958  */
22959  void set_value(const std::shared_ptr<Double>& value);
22960 
22961 
22962  /// \}
22963 
22964  /// \name Visitor
22965  /// \{
22966 
22967  /**
22968  * \brief visit children i.e. member variables of current node using provided visitor
22969  *
22970  * Different nodes in the AST have different members (i.e. children). This method
22971  * recursively visits children using provided visitor.
22972  *
22973  * \param v Concrete visitor that will be used to recursively visit children
22974  *
22975  * \sa Ast::visit_children for example.
22976  */
22977  void visit_children(visitor::Visitor& v) override;
22978 
22979  /**
22980  * \brief visit children i.e. member variables of current node using provided visitor
22981  *
22982  * Different nodes in the AST have different members (i.e. children). This method
22983  * recursively visits children using provided visitor.
22984  *
22985  * \param v Concrete constant visitor that will be used to recursively visit children
22986  *
22987  * \sa Ast::visit_children for example.
22988  */
22989  void visit_children(visitor::ConstVisitor& v) const override;
22990 
22991  /**
22992  * \brief accept (or visit) the current AST node using provided visitor
22993  *
22994  * Instead of visiting children of AST node, like Ast::visit_children,
22995  * accept allows to visit the current node itself using provided concrete
22996  * visitor.
22997  *
22998  * \param v Concrete visitor that will be used to recursively visit node
22999  *
23000  * \sa Ast::accept for example.
23001  */
23002  void accept(visitor::Visitor& v) override;
23003 
23004  /**
23005  * \copydoc accept(visitor::Visitor&)
23006  */
23007  void accept(visitor::ConstVisitor& v) const override;
23008 
23009  /// \}
23010 
23011 
23012 
23013  private:
23014  /**
23015  * \brief Set this object as parent for all the children
23016  *
23017  * This should be called in every object (with children) constructor
23018  * to set parents. Since it is called only in the constructors it
23019  * should not be virtual to avoid ambiguities (issue #295).
23020  */
23021  void set_parent_in_children();
23022 };
23023 
23024 /** @} */ // end of ast_class
23025 
23026 
23027 } // namespace ast
23028 } // namespace nmodl
23029 #endif // !NMODL_AST_VALENCE_HPP
23030 #ifndef NMODL_AST_UNIT_STATE_HPP
23031 #define NMODL_AST_UNIT_STATE_HPP
23032 
23033 
23034 namespace nmodl {
23035 namespace ast {
23036 
23037 /**
23038  * @addtogroup ast_class
23039  * @ingroup ast
23040  * @{
23041  */
23042 
23043 /**
23044  * \brief TODO
23045  *
23046  *
23047 */
23048 class UnitState : public Statement {
23049  private:
23050  /// TODO
23052  /// token with location information
23053  std::shared_ptr<ModToken> token;
23054 
23055  public:
23056 
23057  /// \name Ctor & dtor
23058  /// \{
23059 
23060  explicit UnitState(UnitStateType value);
23061  UnitState(const UnitState& obj);
23062 
23063 
23064  virtual ~UnitState() = default;
23065 
23066  /// \}
23067 
23068 
23069 
23070 
23071 
23072 
23073  /**
23074  * \brief Check if the ast node is an instance of ast::UnitState
23075  * \return true as object is of type ast::UnitState
23076  */
23077  bool is_unit_state () const noexcept override {
23078  return true;
23079  }
23080 
23081  /**
23082  * \brief Return a copy of the current node
23083  *
23084  * Recursively make a new copy/clone of the current node including
23085  * all members and return a pointer to the node. This is used for
23086  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23087  * ast.
23088  *
23089  * @return pointer to the clone/copy of the current node
23090  */
23091  UnitState* clone() const override {
23092  return new UnitState(*this);
23093  }
23094 
23095  /// \name Getters
23096  /// \{
23097 
23098  /**
23099  * \brief Return type (ast::AstNodeType) of ast node
23100  *
23101  * Every node in the ast has a type defined in ast::AstNodeType and this
23102  * function is used to retrieve the same.
23103  *
23104  * \return ast node type i.e. ast::AstNodeType::UNIT_STATE
23105  *
23106  * \sa Ast::get_node_type_name
23107  */
23108  AstNodeType get_node_type() const noexcept override {
23109  return AstNodeType::UNIT_STATE;
23110  }
23111 
23112  /**
23113  * \brief Return type (ast::AstNodeType) of ast node as std::string
23114  *
23115  * Every node in the ast has a type defined in ast::AstNodeType.
23116  * This type name can be returned as a std::string for printing
23117  * node to text/json form.
23118  *
23119  * \return name of the node type as a string i.e. "UnitState"
23120  *
23121  * \sa Ast::get_node_name
23122  */
23123  std::string get_node_type_name() const noexcept override {
23124  return "UnitState";
23125  }
23126 
23127 
23128  /**
23129  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23130  */
23131  std::shared_ptr<Ast> get_shared_ptr() override {
23132  return std::static_pointer_cast<UnitState>(shared_from_this());
23133  }
23134 
23135  /**
23136  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23137  */
23138  std::shared_ptr<const Ast> get_shared_ptr() const override {
23139  return std::static_pointer_cast<const UnitState>(shared_from_this());
23140  }
23141 
23142  /**
23143  * \brief Return associated token for the current ast node
23144  *
23145  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
23146  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
23147  * nullptr to store in the nmodl::symtab::SymbolTable.
23148  *
23149  * \return pointer to token if exist otherwise nullptr
23150  */
23151  const ModToken* get_token() const noexcept override {
23152  return token.get();
23153  }
23154 
23155 
23156 
23157 
23158 
23159 
23160 
23161 
23162  /**
23163  * \brief Getter for member variable \ref UnitState.value
23164  */
23165  UnitStateType get_value() const noexcept {
23166  return value;
23167  }
23168 
23169 
23170 
23171  /// \}
23172 
23173  /// \name Setters
23174  /// \{
23175 
23176 
23177  /**
23178  * \brief Set token for the current ast node
23179  */
23180  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
23181 
23182 
23183 
23184 
23185  /**
23186  * \brief Setter for member variable \ref UnitState.value
23187  */
23188  void set_value(UnitStateType value);
23189 
23190 
23191  /// \}
23192 
23193  /// \name Visitor
23194  /// \{
23195 
23196  /**
23197  * \brief visit children i.e. member variables of current node using provided visitor
23198  *
23199  * Different nodes in the AST have different members (i.e. children). This method
23200  * recursively visits children using provided visitor.
23201  *
23202  * \param v Concrete visitor that will be used to recursively visit children
23203  *
23204  * \sa Ast::visit_children for example.
23205  */
23206  void visit_children(visitor::Visitor& v) override;
23207 
23208  /**
23209  * \brief visit children i.e. member variables of current node using provided visitor
23210  *
23211  * Different nodes in the AST have different members (i.e. children). This method
23212  * recursively visits children using provided visitor.
23213  *
23214  * \param v Concrete constant visitor that will be used to recursively visit children
23215  *
23216  * \sa Ast::visit_children for example.
23217  */
23218  void visit_children(visitor::ConstVisitor& v) const override;
23219 
23220  /**
23221  * \brief accept (or visit) the current AST node using provided visitor
23222  *
23223  * Instead of visiting children of AST node, like Ast::visit_children,
23224  * accept allows to visit the current node itself using provided concrete
23225  * visitor.
23226  *
23227  * \param v Concrete visitor that will be used to recursively visit node
23228  *
23229  * \sa Ast::accept for example.
23230  */
23231  void accept(visitor::Visitor& v) override;
23232 
23233  /**
23234  * \copydoc accept(visitor::Visitor&)
23235  */
23236  void accept(visitor::ConstVisitor& v) const override;
23237 
23238  /// \}
23239 
23240 
23241  /**
23242  * \brief Return enum value in string form
23243  *
23244  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
23245  * string representation when they are converted from AST back to
23246  * NMODL. This method is used to return corresponding string representation.
23247  */
23248  std::string eval() const {
23249  return UnitStateTypeNames[value];
23250  }
23251 
23252 
23253  private:
23254  /**
23255  * \brief Set this object as parent for all the children
23256  *
23257  * This should be called in every object (with children) constructor
23258  * to set parents. Since it is called only in the constructors it
23259  * should not be virtual to avoid ambiguities (issue #295).
23260  */
23261  void set_parent_in_children();
23262 };
23263 
23264 /** @} */ // end of ast_class
23265 
23266 
23267 } // namespace ast
23268 } // namespace nmodl
23269 #endif // !NMODL_AST_UNIT_STATE_HPP
23270 #ifndef NMODL_AST_LOCAL_LIST_STATEMENT_HPP
23271 #define NMODL_AST_LOCAL_LIST_STATEMENT_HPP
23272 #define NMODL_AST_LOCAL_LIST_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
23273 
23274 
23275 namespace nmodl {
23276 namespace ast {
23277 
23278 /**
23279  * @addtogroup ast_class
23280  * @ingroup ast
23281  * @{
23282  */
23283 
23284 /**
23285  * \brief TODO
23286  *
23287  *
23288 */
23290  private:
23291  /// TODO
23293  /// token with location information
23294  std::shared_ptr<ModToken> token;
23295 
23296  public:
23297 
23298  /// \name Ctor & dtor
23299  /// \{
23300 
23301  explicit LocalListStatement(LocalVarVector variables);
23303 
23304 
23305  virtual ~LocalListStatement() = default;
23306 
23307  /// \}
23308 
23309 
23310 
23311 
23312 
23313 
23314  /**
23315  * \brief Check if the ast node is an instance of ast::LocalListStatement
23316  * \return true as object is of type ast::LocalListStatement
23317  */
23318  bool is_local_list_statement () const noexcept override {
23319  return true;
23320  }
23321 
23322  /**
23323  * \brief Return a copy of the current node
23324  *
23325  * Recursively make a new copy/clone of the current node including
23326  * all members and return a pointer to the node. This is used for
23327  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23328  * ast.
23329  *
23330  * @return pointer to the clone/copy of the current node
23331  */
23332  LocalListStatement* clone() const override {
23333  return new LocalListStatement(*this);
23334  }
23335 
23336  /// \name Getters
23337  /// \{
23338 
23339  /**
23340  * \brief Return type (ast::AstNodeType) of ast node
23341  *
23342  * Every node in the ast has a type defined in ast::AstNodeType and this
23343  * function is used to retrieve the same.
23344  *
23345  * \return ast node type i.e. ast::AstNodeType::LOCAL_LIST_STATEMENT
23346  *
23347  * \sa Ast::get_node_type_name
23348  */
23349  AstNodeType get_node_type() const noexcept override {
23351  }
23352 
23353  /**
23354  * \brief Return type (ast::AstNodeType) of ast node as std::string
23355  *
23356  * Every node in the ast has a type defined in ast::AstNodeType.
23357  * This type name can be returned as a std::string for printing
23358  * node to text/json form.
23359  *
23360  * \return name of the node type as a string i.e. "LocalListStatement"
23361  *
23362  * \sa Ast::get_node_name
23363  */
23364  std::string get_node_type_name() const noexcept override {
23365  return "LocalListStatement";
23366  }
23367 
23368  /**
23369  * \brief Return NMODL statement of ast node as std::string
23370  *
23371  * Every node is related to a special statement in the NMODL. This
23372  * statement can be returned as a std::string for printing to
23373  * text/json form.
23374  *
23375  * \return name of the statement as a string i.e. "LOCAL "
23376  *
23377  * \sa Ast::get_nmodl_name
23378  */
23379  std::string get_nmodl_name() const noexcept override {
23380  return "LOCAL ";
23381  }
23382 
23383  /**
23384  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23385  */
23386  std::shared_ptr<Ast> get_shared_ptr() override {
23387  return std::static_pointer_cast<LocalListStatement>(shared_from_this());
23388  }
23389 
23390  /**
23391  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23392  */
23393  std::shared_ptr<const Ast> get_shared_ptr() const override {
23394  return std::static_pointer_cast<const LocalListStatement>(shared_from_this());
23395  }
23396 
23397  /**
23398  * \brief Return associated token for the current ast node
23399  *
23400  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
23401  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
23402  * nullptr to store in the nmodl::symtab::SymbolTable.
23403  *
23404  * \return pointer to token if exist otherwise nullptr
23405  */
23406  const ModToken* get_token() const noexcept override {
23407  return token.get();
23408  }
23409 
23410 
23411 
23412 
23413 /**
23414  * \brief Add member to variables by raw pointer
23415  */
23416 void emplace_back_local_var(LocalVar *n);
23417 
23418 /**
23419  * \brief Add member to variables by shared_ptr
23420  */
23421 void emplace_back_local_var(std::shared_ptr<LocalVar> n);
23422 
23423 /**
23424  * \brief Erase member to variables
23425  */
23426 LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first);
23427 
23428 /**
23429  * \brief Erase members to variables
23430  */
23431 LocalVarVector::const_iterator erase_local_var(LocalVarVector::const_iterator first, LocalVarVector::const_iterator last);
23432 
23433 /**
23434  * \brief Erase non-consecutive members to variables
23435  *
23436  * loosely following the cpp reference of remove_if
23437  */
23438 size_t erase_local_var(std::unordered_set<LocalVar*>& to_be_erased);
23439 
23440 /**
23441  * \brief Insert member to variables
23442  */
23443 LocalVarVector::const_iterator insert_local_var(LocalVarVector::const_iterator position, const std::shared_ptr<LocalVar>& n);
23444 
23445 /**
23446  * \brief Insert members to variables
23447  */
23448 template <class NodeType, class InputIterator>
23449 void insert_local_var(LocalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last);
23450 
23451 /**
23452  * \brief Reset member to variables
23453  */
23454 void reset_local_var(LocalVarVector::const_iterator position, LocalVar* n);
23455 
23456 /**
23457  * \brief Reset member to variables
23458  */
23459 void reset_local_var(LocalVarVector::const_iterator position, std::shared_ptr<LocalVar> n);
23460 
23461 
23462 
23463 
23464 
23465  /**
23466  * \brief Getter for member variable \ref LocalListStatement.variables
23467  */
23468  const LocalVarVector& get_variables() const noexcept {
23469  return variables;
23470  }
23471 
23472 
23473 
23474  /// \}
23475 
23476  /// \name Setters
23477  /// \{
23478 
23479 
23480  /**
23481  * \brief Set token for the current ast node
23482  */
23483  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
23484 
23485 
23486 
23487 
23488  /**
23489  * \brief Setter for member variable \ref LocalListStatement.variables (rvalue reference)
23490  */
23491  void set_variables(LocalVarVector&& variables);
23492 
23493  /**
23494  * \brief Setter for member variable \ref LocalListStatement.variables
23495  */
23496  void set_variables(const LocalVarVector& variables);
23497 
23498 
23499  /// \}
23500 
23501  /// \name Visitor
23502  /// \{
23503 
23504  /**
23505  * \brief visit children i.e. member variables of current node using provided visitor
23506  *
23507  * Different nodes in the AST have different members (i.e. children). This method
23508  * recursively visits children using provided visitor.
23509  *
23510  * \param v Concrete visitor that will be used to recursively visit children
23511  *
23512  * \sa Ast::visit_children for example.
23513  */
23514  void visit_children(visitor::Visitor& v) override;
23515 
23516  /**
23517  * \brief visit children i.e. member variables of current node using provided visitor
23518  *
23519  * Different nodes in the AST have different members (i.e. children). This method
23520  * recursively visits children using provided visitor.
23521  *
23522  * \param v Concrete constant visitor that will be used to recursively visit children
23523  *
23524  * \sa Ast::visit_children for example.
23525  */
23526  void visit_children(visitor::ConstVisitor& v) const override;
23527 
23528  /**
23529  * \brief accept (or visit) the current AST node using provided visitor
23530  *
23531  * Instead of visiting children of AST node, like Ast::visit_children,
23532  * accept allows to visit the current node itself using provided concrete
23533  * visitor.
23534  *
23535  * \param v Concrete visitor that will be used to recursively visit node
23536  *
23537  * \sa Ast::accept for example.
23538  */
23539  void accept(visitor::Visitor& v) override;
23540 
23541  /**
23542  * \copydoc accept(visitor::Visitor&)
23543  */
23544  void accept(visitor::ConstVisitor& v) const override;
23545 
23546  /// \}
23547 
23548 
23549 
23550  private:
23551  /**
23552  * \brief Set this object as parent for all the children
23553  *
23554  * This should be called in every object (with children) constructor
23555  * to set parents. Since it is called only in the constructors it
23556  * should not be virtual to avoid ambiguities (issue #295).
23557  */
23558  void set_parent_in_children();
23559 };
23560 
23561 /** @} */ // end of ast_class
23562 
23563 
23564 } // namespace ast
23565 } // namespace nmodl
23566 #endif // !NMODL_AST_LOCAL_LIST_STATEMENT_HPP
23567 #ifndef NMODL_AST_MODEL_HPP
23568 #define NMODL_AST_MODEL_HPP
23569 
23570 
23571 namespace nmodl {
23572 namespace ast {
23573 
23574 /**
23575  * @addtogroup ast_class
23576  * @ingroup ast
23577  * @{
23578  */
23579 
23580 /**
23581  * \brief TODO
23582  *
23583  *
23584 */
23585 class Model : public Statement {
23586  private:
23587  /// TODO
23588  std::shared_ptr<String> title;
23589  /// token with location information
23590  std::shared_ptr<ModToken> token;
23591 
23592  public:
23593 
23594  /// \name Ctor & dtor
23595  /// \{
23596 
23597  explicit Model(String* title);
23598  explicit Model(const std::shared_ptr<String>& title);
23599  Model(const Model& obj);
23600 
23601 
23602  virtual ~Model() = default;
23603 
23604  /// \}
23605 
23606 
23607 
23608 
23609 
23610 
23611  /**
23612  * \brief Check if the ast node is an instance of ast::Model
23613  * \return true as object is of type ast::Model
23614  */
23615  bool is_model () const noexcept override {
23616  return true;
23617  }
23618 
23619  /**
23620  * \brief Return a copy of the current node
23621  *
23622  * Recursively make a new copy/clone of the current node including
23623  * all members and return a pointer to the node. This is used for
23624  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23625  * ast.
23626  *
23627  * @return pointer to the clone/copy of the current node
23628  */
23629  Model* clone() const override {
23630  return new Model(*this);
23631  }
23632 
23633  /// \name Getters
23634  /// \{
23635 
23636  /**
23637  * \brief Return type (ast::AstNodeType) of ast node
23638  *
23639  * Every node in the ast has a type defined in ast::AstNodeType and this
23640  * function is used to retrieve the same.
23641  *
23642  * \return ast node type i.e. ast::AstNodeType::MODEL
23643  *
23644  * \sa Ast::get_node_type_name
23645  */
23646  AstNodeType get_node_type() const noexcept override {
23647  return AstNodeType::MODEL;
23648  }
23649 
23650  /**
23651  * \brief Return type (ast::AstNodeType) of ast node as std::string
23652  *
23653  * Every node in the ast has a type defined in ast::AstNodeType.
23654  * This type name can be returned as a std::string for printing
23655  * node to text/json form.
23656  *
23657  * \return name of the node type as a string i.e. "Model"
23658  *
23659  * \sa Ast::get_node_name
23660  */
23661  std::string get_node_type_name() const noexcept override {
23662  return "Model";
23663  }
23664 
23665  /**
23666  * \brief Return NMODL statement of ast node as std::string
23667  *
23668  * Every node is related to a special statement in the NMODL. This
23669  * statement can be returned as a std::string for printing to
23670  * text/json form.
23671  *
23672  * \return name of the statement as a string i.e. "TITLE"
23673  *
23674  * \sa Ast::get_nmodl_name
23675  */
23676  std::string get_nmodl_name() const noexcept override {
23677  return "TITLE";
23678  }
23679 
23680  /**
23681  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23682  */
23683  std::shared_ptr<Ast> get_shared_ptr() override {
23684  return std::static_pointer_cast<Model>(shared_from_this());
23685  }
23686 
23687  /**
23688  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23689  */
23690  std::shared_ptr<const Ast> get_shared_ptr() const override {
23691  return std::static_pointer_cast<const Model>(shared_from_this());
23692  }
23693 
23694  /**
23695  * \brief Return associated token for the current ast node
23696  *
23697  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
23698  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
23699  * nullptr to store in the nmodl::symtab::SymbolTable.
23700  *
23701  * \return pointer to token if exist otherwise nullptr
23702  */
23703  const ModToken* get_token() const noexcept override {
23704  return token.get();
23705  }
23706 
23707 
23708 
23709 
23710 
23711 
23712 
23713 
23714  /**
23715  * \brief Getter for member variable \ref Model.title
23716  */
23717  const std::shared_ptr<String>& get_title() const noexcept {
23718  return title;
23719  }
23720 
23721 
23722 
23723  /// \}
23724 
23725  /// \name Setters
23726  /// \{
23727 
23728 
23729  /**
23730  * \brief Set token for the current ast node
23731  */
23732  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
23733 
23734 
23735 
23736 
23737  /**
23738  * \brief Setter for member variable \ref Model.title (rvalue reference)
23739  */
23740  void set_title(std::shared_ptr<String>&& title);
23741 
23742  /**
23743  * \brief Setter for member variable \ref Model.title
23744  */
23745  void set_title(const std::shared_ptr<String>& title);
23746 
23747 
23748  /// \}
23749 
23750  /// \name Visitor
23751  /// \{
23752 
23753  /**
23754  * \brief visit children i.e. member variables of current node using provided visitor
23755  *
23756  * Different nodes in the AST have different members (i.e. children). This method
23757  * recursively visits children using provided visitor.
23758  *
23759  * \param v Concrete visitor that will be used to recursively visit children
23760  *
23761  * \sa Ast::visit_children for example.
23762  */
23763  void visit_children(visitor::Visitor& v) override;
23764 
23765  /**
23766  * \brief visit children i.e. member variables of current node using provided visitor
23767  *
23768  * Different nodes in the AST have different members (i.e. children). This method
23769  * recursively visits children using provided visitor.
23770  *
23771  * \param v Concrete constant visitor that will be used to recursively visit children
23772  *
23773  * \sa Ast::visit_children for example.
23774  */
23775  void visit_children(visitor::ConstVisitor& v) const override;
23776 
23777  /**
23778  * \brief accept (or visit) the current AST node using provided visitor
23779  *
23780  * Instead of visiting children of AST node, like Ast::visit_children,
23781  * accept allows to visit the current node itself using provided concrete
23782  * visitor.
23783  *
23784  * \param v Concrete visitor that will be used to recursively visit node
23785  *
23786  * \sa Ast::accept for example.
23787  */
23788  void accept(visitor::Visitor& v) override;
23789 
23790  /**
23791  * \copydoc accept(visitor::Visitor&)
23792  */
23793  void accept(visitor::ConstVisitor& v) const override;
23794 
23795  /// \}
23796 
23797 
23798 
23799  private:
23800  /**
23801  * \brief Set this object as parent for all the children
23802  *
23803  * This should be called in every object (with children) constructor
23804  * to set parents. Since it is called only in the constructors it
23805  * should not be virtual to avoid ambiguities (issue #295).
23806  */
23807  void set_parent_in_children();
23808 };
23809 
23810 /** @} */ // end of ast_class
23811 
23812 
23813 } // namespace ast
23814 } // namespace nmodl
23815 #endif // !NMODL_AST_MODEL_HPP
23816 #ifndef NMODL_AST_DEFINE_HPP
23817 #define NMODL_AST_DEFINE_HPP
23818 
23819 
23820 namespace nmodl {
23821 namespace ast {
23822 
23823 /**
23824  * @addtogroup ast_class
23825  * @ingroup ast
23826  * @{
23827  */
23828 
23829 /**
23830  * \brief Represents a `DEFINE` statement in NMODL
23831  *
23832  *
23833 */
23834 class Define : public Statement {
23835  private:
23836  /// Name of the macro
23837  std::shared_ptr<Name> name;
23838  /// Value of the macro
23839  std::shared_ptr<Integer> value;
23840  /// token with location information
23841  std::shared_ptr<ModToken> token;
23842 
23843  public:
23844 
23845  /// \name Ctor & dtor
23846  /// \{
23847 
23848  explicit Define(Name* name, Integer* value);
23849  explicit Define(const std::shared_ptr<Name>& name, const std::shared_ptr<Integer>& value);
23850  Define(const Define& obj);
23851 
23852 
23853  virtual ~Define() = default;
23854 
23855  /// \}
23856 
23857 
23858 
23859 
23860 
23861 
23862  /**
23863  * \brief Check if the ast node is an instance of ast::Define
23864  * \return true as object is of type ast::Define
23865  */
23866  bool is_define () const noexcept override {
23867  return true;
23868  }
23869 
23870  /**
23871  * \brief Return a copy of the current node
23872  *
23873  * Recursively make a new copy/clone of the current node including
23874  * all members and return a pointer to the node. This is used for
23875  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23876  * ast.
23877  *
23878  * @return pointer to the clone/copy of the current node
23879  */
23880  Define* clone() const override {
23881  return new Define(*this);
23882  }
23883 
23884  /// \name Getters
23885  /// \{
23886 
23887  /**
23888  * \brief Return type (ast::AstNodeType) of ast node
23889  *
23890  * Every node in the ast has a type defined in ast::AstNodeType and this
23891  * function is used to retrieve the same.
23892  *
23893  * \return ast node type i.e. ast::AstNodeType::DEFINE
23894  *
23895  * \sa Ast::get_node_type_name
23896  */
23897  AstNodeType get_node_type() const noexcept override {
23898  return AstNodeType::DEFINE;
23899  }
23900 
23901  /**
23902  * \brief Return type (ast::AstNodeType) of ast node as std::string
23903  *
23904  * Every node in the ast has a type defined in ast::AstNodeType.
23905  * This type name can be returned as a std::string for printing
23906  * node to text/json form.
23907  *
23908  * \return name of the node type as a string i.e. "Define"
23909  *
23910  * \sa Ast::get_node_name
23911  */
23912  std::string get_node_type_name() const noexcept override {
23913  return "Define";
23914  }
23915 
23916  /**
23917  * \brief Return NMODL statement of ast node as std::string
23918  *
23919  * Every node is related to a special statement in the NMODL. This
23920  * statement can be returned as a std::string for printing to
23921  * text/json form.
23922  *
23923  * \return name of the statement as a string i.e. "DEFINE "
23924  *
23925  * \sa Ast::get_nmodl_name
23926  */
23927  std::string get_nmodl_name() const noexcept override {
23928  return "DEFINE ";
23929  }
23930 
23931  /**
23932  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23933  */
23934  std::shared_ptr<Ast> get_shared_ptr() override {
23935  return std::static_pointer_cast<Define>(shared_from_this());
23936  }
23937 
23938  /**
23939  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23940  */
23941  std::shared_ptr<const Ast> get_shared_ptr() const override {
23942  return std::static_pointer_cast<const Define>(shared_from_this());
23943  }
23944 
23945  /**
23946  * \brief Return associated token for the current ast node
23947  *
23948  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
23949  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
23950  * nullptr to store in the nmodl::symtab::SymbolTable.
23951  *
23952  * \return pointer to token if exist otherwise nullptr
23953  */
23954  const ModToken* get_token() const noexcept override {
23955  return token.get();
23956  }
23957 
23958 
23959 
23960 
23961 
23962 
23963 /**
23964  * \brief Return name of the node
23965  *
23966  * Some ast nodes have a member marked designated as node name. For example,
23967  * in case of this ast::Name has name designated as a
23968  * node name.
23969  *
23970  * @return name of the node as std::string
23971  *
23972  * \sa Ast::get_node_type_name
23973  */
23974 std::string get_node_name() const override;
23975 
23976 
23977  /**
23978  * \brief Getter for member variable \ref Define.name
23979  */
23980  const std::shared_ptr<Name>& get_name() const noexcept {
23981  return name;
23982  }
23983 
23984 
23985 
23986 
23987 
23988 
23989 
23990  /**
23991  * \brief Getter for member variable \ref Define.value
23992  */
23993  const std::shared_ptr<Integer>& get_value() const noexcept {
23994  return value;
23995  }
23996 
23997 
23998 
23999  /// \}
24000 
24001  /// \name Setters
24002  /// \{
24003 
24004 
24005  /**
24006  * \brief Set token for the current ast node
24007  */
24008  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
24009 
24010 
24011 
24012 
24013  /**
24014  * \brief Setter for member variable \ref Define.name (rvalue reference)
24015  */
24016  void set_name(std::shared_ptr<Name>&& name);
24017 
24018  /**
24019  * \brief Setter for member variable \ref Define.name
24020  */
24021  void set_name(const std::shared_ptr<Name>& name);
24022 
24023 
24024  /**
24025  * \brief Setter for member variable \ref Define.value (rvalue reference)
24026  */
24027  void set_value(std::shared_ptr<Integer>&& value);
24028 
24029  /**
24030  * \brief Setter for member variable \ref Define.value
24031  */
24032  void set_value(const std::shared_ptr<Integer>& value);
24033 
24034 
24035  /// \}
24036 
24037  /// \name Visitor
24038  /// \{
24039 
24040  /**
24041  * \brief visit children i.e. member variables of current node using provided visitor
24042  *
24043  * Different nodes in the AST have different members (i.e. children). This method
24044  * recursively visits children using provided visitor.
24045  *
24046  * \param v Concrete visitor that will be used to recursively visit children
24047  *
24048  * \sa Ast::visit_children for example.
24049  */
24050  void visit_children(visitor::Visitor& v) override;
24051 
24052  /**
24053  * \brief visit children i.e. member variables of current node using provided visitor
24054  *
24055  * Different nodes in the AST have different members (i.e. children). This method
24056  * recursively visits children using provided visitor.
24057  *
24058  * \param v Concrete constant visitor that will be used to recursively visit children
24059  *
24060  * \sa Ast::visit_children for example.
24061  */
24062  void visit_children(visitor::ConstVisitor& v) const override;
24063 
24064  /**
24065  * \brief accept (or visit) the current AST node using provided visitor
24066  *
24067  * Instead of visiting children of AST node, like Ast::visit_children,
24068  * accept allows to visit the current node itself using provided concrete
24069  * visitor.
24070  *
24071  * \param v Concrete visitor that will be used to recursively visit node
24072  *
24073  * \sa Ast::accept for example.
24074  */
24075  void accept(visitor::Visitor& v) override;
24076 
24077  /**
24078  * \copydoc accept(visitor::Visitor&)
24079  */
24080  void accept(visitor::ConstVisitor& v) const override;
24081 
24082  /// \}
24083 
24084 
24085 
24086  private:
24087  /**
24088  * \brief Set this object as parent for all the children
24089  *
24090  * This should be called in every object (with children) constructor
24091  * to set parents. Since it is called only in the constructors it
24092  * should not be virtual to avoid ambiguities (issue #295).
24093  */
24094  void set_parent_in_children();
24095 };
24096 
24097 /** @} */ // end of ast_class
24098 
24099 
24100 } // namespace ast
24101 } // namespace nmodl
24102 #endif // !NMODL_AST_DEFINE_HPP
24103 #ifndef NMODL_AST_INCLUDE_HPP
24104 #define NMODL_AST_INCLUDE_HPP
24105 
24106 
24107 namespace nmodl {
24108 namespace ast {
24109 
24110 /**
24111  * @addtogroup ast_class
24112  * @ingroup ast
24113  * @{
24114  */
24115 
24116 /**
24117  * \brief Represents an `INCLUDE` statement in NMODL
24118  *
24119  *
24120 */
24121 class Include : public Statement {
24122  private:
24123  /// path to the file to include
24124  std::shared_ptr<String> filename;
24125  /// AST of the included file
24127  /// token with location information
24128  std::shared_ptr<ModToken> token;
24129 
24130  public:
24131 
24132  /// \name Ctor & dtor
24133  /// \{
24134 
24135  explicit Include(String* filename, NodeVector blocks);
24136  explicit Include(const std::shared_ptr<String>& filename, const NodeVector& blocks);
24137  Include(const Include& obj);
24138 
24139 
24140  virtual ~Include() = default;
24141 
24142  /// \}
24143 
24144 
24145 
24146 
24147 
24148 
24149  /**
24150  * \brief Check if the ast node is an instance of ast::Include
24151  * \return true as object is of type ast::Include
24152  */
24153  bool is_include () const noexcept override {
24154  return true;
24155  }
24156 
24157  /**
24158  * \brief Return a copy of the current node
24159  *
24160  * Recursively make a new copy/clone of the current node including
24161  * all members and return a pointer to the node. This is used for
24162  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24163  * ast.
24164  *
24165  * @return pointer to the clone/copy of the current node
24166  */
24167  Include* clone() const override {
24168  return new Include(*this);
24169  }
24170 
24171  /// \name Getters
24172  /// \{
24173 
24174  /**
24175  * \brief Return type (ast::AstNodeType) of ast node
24176  *
24177  * Every node in the ast has a type defined in ast::AstNodeType and this
24178  * function is used to retrieve the same.
24179  *
24180  * \return ast node type i.e. ast::AstNodeType::INCLUDE
24181  *
24182  * \sa Ast::get_node_type_name
24183  */
24184  AstNodeType get_node_type() const noexcept override {
24185  return AstNodeType::INCLUDE;
24186  }
24187 
24188  /**
24189  * \brief Return type (ast::AstNodeType) of ast node as std::string
24190  *
24191  * Every node in the ast has a type defined in ast::AstNodeType.
24192  * This type name can be returned as a std::string for printing
24193  * node to text/json form.
24194  *
24195  * \return name of the node type as a string i.e. "Include"
24196  *
24197  * \sa Ast::get_node_name
24198  */
24199  std::string get_node_type_name() const noexcept override {
24200  return "Include";
24201  }
24202 
24203  /**
24204  * \brief Return NMODL statement of ast node as std::string
24205  *
24206  * Every node is related to a special statement in the NMODL. This
24207  * statement can be returned as a std::string for printing to
24208  * text/json form.
24209  *
24210  * \return name of the statement as a string i.e. "INCLUDE "
24211  *
24212  * \sa Ast::get_nmodl_name
24213  */
24214  std::string get_nmodl_name() const noexcept override {
24215  return "INCLUDE ";
24216  }
24217 
24218  /**
24219  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24220  */
24221  std::shared_ptr<Ast> get_shared_ptr() override {
24222  return std::static_pointer_cast<Include>(shared_from_this());
24223  }
24224 
24225  /**
24226  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24227  */
24228  std::shared_ptr<const Ast> get_shared_ptr() const override {
24229  return std::static_pointer_cast<const Include>(shared_from_this());
24230  }
24231 
24232  /**
24233  * \brief Return associated token for the current ast node
24234  *
24235  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
24236  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
24237  * nullptr to store in the nmodl::symtab::SymbolTable.
24238  *
24239  * \return pointer to token if exist otherwise nullptr
24240  */
24241  const ModToken* get_token() const noexcept override {
24242  return token.get();
24243  }
24244 
24245 
24246 
24247 
24248 
24249 
24250 
24251 
24252  /**
24253  * \brief Getter for member variable \ref Include.filename
24254  */
24255  const std::shared_ptr<String>& get_filename() const noexcept {
24256  return filename;
24257  }
24258 
24259 
24260 
24261 
24262 
24263 
24264 
24265  /**
24266  * \brief Getter for member variable \ref Include.blocks
24267  */
24268  const NodeVector& get_blocks() const noexcept {
24269  return blocks;
24270  }
24271 
24272 
24273 
24274  /// \}
24275 
24276  /// \name Setters
24277  /// \{
24278 
24279 
24280  /**
24281  * \brief Set token for the current ast node
24282  */
24283  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
24284 
24285 
24286 
24287 
24288  /**
24289  * \brief Setter for member variable \ref Include.filename (rvalue reference)
24290  */
24291  void set_filename(std::shared_ptr<String>&& filename);
24292 
24293  /**
24294  * \brief Setter for member variable \ref Include.filename
24295  */
24296  void set_filename(const std::shared_ptr<String>& filename);
24297 
24298 
24299  /**
24300  * \brief Setter for member variable \ref Include.blocks (rvalue reference)
24301  */
24302  void set_blocks(NodeVector&& blocks);
24303 
24304  /**
24305  * \brief Setter for member variable \ref Include.blocks
24306  */
24307  void set_blocks(const NodeVector& blocks);
24308 
24309 
24310  /// \}
24311 
24312  /// \name Visitor
24313  /// \{
24314 
24315  /**
24316  * \brief visit children i.e. member variables of current node using provided visitor
24317  *
24318  * Different nodes in the AST have different members (i.e. children). This method
24319  * recursively visits children using provided visitor.
24320  *
24321  * \param v Concrete visitor that will be used to recursively visit children
24322  *
24323  * \sa Ast::visit_children for example.
24324  */
24325  void visit_children(visitor::Visitor& v) override;
24326 
24327  /**
24328  * \brief visit children i.e. member variables of current node using provided visitor
24329  *
24330  * Different nodes in the AST have different members (i.e. children). This method
24331  * recursively visits children using provided visitor.
24332  *
24333  * \param v Concrete constant visitor that will be used to recursively visit children
24334  *
24335  * \sa Ast::visit_children for example.
24336  */
24337  void visit_children(visitor::ConstVisitor& v) const override;
24338 
24339  /**
24340  * \brief accept (or visit) the current AST node using provided visitor
24341  *
24342  * Instead of visiting children of AST node, like Ast::visit_children,
24343  * accept allows to visit the current node itself using provided concrete
24344  * visitor.
24345  *
24346  * \param v Concrete visitor that will be used to recursively visit node
24347  *
24348  * \sa Ast::accept for example.
24349  */
24350  void accept(visitor::Visitor& v) override;
24351 
24352  /**
24353  * \copydoc accept(visitor::Visitor&)
24354  */
24355  void accept(visitor::ConstVisitor& v) const override;
24356 
24357  /// \}
24358 
24359 
24360 
24361  private:
24362  /**
24363  * \brief Set this object as parent for all the children
24364  *
24365  * This should be called in every object (with children) constructor
24366  * to set parents. Since it is called only in the constructors it
24367  * should not be virtual to avoid ambiguities (issue #295).
24368  */
24369  void set_parent_in_children();
24370 };
24371 
24372 /** @} */ // end of ast_class
24373 
24374 
24375 } // namespace ast
24376 } // namespace nmodl
24377 #endif // !NMODL_AST_INCLUDE_HPP
24378 #ifndef NMODL_AST_PARAM_ASSIGN_HPP
24379 #define NMODL_AST_PARAM_ASSIGN_HPP
24380 
24381 
24382 namespace nmodl {
24383 namespace ast {
24384 
24385 /**
24386  * @addtogroup ast_class
24387  * @ingroup ast
24388  * @{
24389  */
24390 
24391 /**
24392  * \brief TODO
24393  *
24394  *
24395 */
24396 class ParamAssign : public Statement {
24397  private:
24398  /// TODO
24399  std::shared_ptr<Identifier> name;
24400  /// TODO
24401  std::shared_ptr<Number> value;
24402  /// TODO
24403  std::shared_ptr<Unit> unit;
24404  /// TODO
24405  std::shared_ptr<Limits> limit;
24406  /// token with location information
24407  std::shared_ptr<ModToken> token;
24408 
24409  public:
24410 
24411  /// \name Ctor & dtor
24412  /// \{
24413 
24414  explicit ParamAssign(Identifier* name, Number* value, Unit* unit, Limits* limit);
24415  explicit ParamAssign(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Number>& value, const std::shared_ptr<Unit>& unit, const std::shared_ptr<Limits>& limit);
24416  ParamAssign(const ParamAssign& obj);
24417 
24418 
24419  virtual ~ParamAssign() = default;
24420 
24421  /// \}
24422 
24423 
24424 
24425 
24426 
24427 
24428  /**
24429  * \brief Check if the ast node is an instance of ast::ParamAssign
24430  * \return true as object is of type ast::ParamAssign
24431  */
24432  bool is_param_assign () const noexcept override {
24433  return true;
24434  }
24435 
24436  /**
24437  * \brief Return a copy of the current node
24438  *
24439  * Recursively make a new copy/clone of the current node including
24440  * all members and return a pointer to the node. This is used for
24441  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24442  * ast.
24443  *
24444  * @return pointer to the clone/copy of the current node
24445  */
24446  ParamAssign* clone() const override {
24447  return new ParamAssign(*this);
24448  }
24449 
24450  /// \name Getters
24451  /// \{
24452 
24453  /**
24454  * \brief Return type (ast::AstNodeType) of ast node
24455  *
24456  * Every node in the ast has a type defined in ast::AstNodeType and this
24457  * function is used to retrieve the same.
24458  *
24459  * \return ast node type i.e. ast::AstNodeType::PARAM_ASSIGN
24460  *
24461  * \sa Ast::get_node_type_name
24462  */
24463  AstNodeType get_node_type() const noexcept override {
24465  }
24466 
24467  /**
24468  * \brief Return type (ast::AstNodeType) of ast node as std::string
24469  *
24470  * Every node in the ast has a type defined in ast::AstNodeType.
24471  * This type name can be returned as a std::string for printing
24472  * node to text/json form.
24473  *
24474  * \return name of the node type as a string i.e. "ParamAssign"
24475  *
24476  * \sa Ast::get_node_name
24477  */
24478  std::string get_node_type_name() const noexcept override {
24479  return "ParamAssign";
24480  }
24481 
24482 
24483  /**
24484  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24485  */
24486  std::shared_ptr<Ast> get_shared_ptr() override {
24487  return std::static_pointer_cast<ParamAssign>(shared_from_this());
24488  }
24489 
24490  /**
24491  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24492  */
24493  std::shared_ptr<const Ast> get_shared_ptr() const override {
24494  return std::static_pointer_cast<const ParamAssign>(shared_from_this());
24495  }
24496 
24497  /**
24498  * \brief Return associated token for the current ast node
24499  *
24500  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
24501  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
24502  * nullptr to store in the nmodl::symtab::SymbolTable.
24503  *
24504  * \return pointer to token if exist otherwise nullptr
24505  */
24506  const ModToken* get_token() const noexcept override {
24507  return token.get();
24508  }
24509 
24510 
24511 
24512 
24513 
24514 
24515 /**
24516  * \brief Return name of the node
24517  *
24518  * Some ast nodes have a member marked designated as node name. For example,
24519  * in case of this ast::Identifier has name designated as a
24520  * node name.
24521  *
24522  * @return name of the node as std::string
24523  *
24524  * \sa Ast::get_node_type_name
24525  */
24526 std::string get_node_name() const override;
24527 
24528 
24529  /**
24530  * \brief Getter for member variable \ref ParamAssign.name
24531  */
24532  const std::shared_ptr<Identifier>& get_name() const noexcept {
24533  return name;
24534  }
24535 
24536 
24537 
24538 
24539 
24540 
24541 
24542  /**
24543  * \brief Getter for member variable \ref ParamAssign.value
24544  */
24545  const std::shared_ptr<Number>& get_value() const noexcept {
24546  return value;
24547  }
24548 
24549 
24550 
24551 
24552 
24553 
24554 
24555  /**
24556  * \brief Getter for member variable \ref ParamAssign.unit
24557  */
24558  const std::shared_ptr<Unit>& get_unit() const noexcept {
24559  return unit;
24560  }
24561 
24562 
24563 
24564 
24565 
24566 
24567 
24568  /**
24569  * \brief Getter for member variable \ref ParamAssign.limit
24570  */
24571  const std::shared_ptr<Limits>& get_limit() const noexcept {
24572  return limit;
24573  }
24574 
24575 
24576 
24577  /// \}
24578 
24579  /// \name Setters
24580  /// \{
24581 
24582 
24583  /**
24584  * \brief Set token for the current ast node
24585  */
24586  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
24587 
24588 
24589 
24590 
24591  /**
24592  * \brief Setter for member variable \ref ParamAssign.name (rvalue reference)
24593  */
24594  void set_name(std::shared_ptr<Identifier>&& name);
24595 
24596  /**
24597  * \brief Setter for member variable \ref ParamAssign.name
24598  */
24599  void set_name(const std::shared_ptr<Identifier>& name);
24600 
24601 
24602  /**
24603  * \brief Setter for member variable \ref ParamAssign.value (rvalue reference)
24604  */
24605  void set_value(std::shared_ptr<Number>&& value);
24606 
24607  /**
24608  * \brief Setter for member variable \ref ParamAssign.value
24609  */
24610  void set_value(const std::shared_ptr<Number>& value);
24611 
24612 
24613  /**
24614  * \brief Setter for member variable \ref ParamAssign.unit (rvalue reference)
24615  */
24616  void set_unit(std::shared_ptr<Unit>&& unit);
24617 
24618  /**
24619  * \brief Setter for member variable \ref ParamAssign.unit
24620  */
24621  void set_unit(const std::shared_ptr<Unit>& unit);
24622 
24623 
24624  /**
24625  * \brief Setter for member variable \ref ParamAssign.limit (rvalue reference)
24626  */
24627  void set_limit(std::shared_ptr<Limits>&& limit);
24628 
24629  /**
24630  * \brief Setter for member variable \ref ParamAssign.limit
24631  */
24632  void set_limit(const std::shared_ptr<Limits>& limit);
24633 
24634 
24635  /// \}
24636 
24637  /// \name Visitor
24638  /// \{
24639 
24640  /**
24641  * \brief visit children i.e. member variables of current node using provided visitor
24642  *
24643  * Different nodes in the AST have different members (i.e. children). This method
24644  * recursively visits children using provided visitor.
24645  *
24646  * \param v Concrete visitor that will be used to recursively visit children
24647  *
24648  * \sa Ast::visit_children for example.
24649  */
24650  void visit_children(visitor::Visitor& v) override;
24651 
24652  /**
24653  * \brief visit children i.e. member variables of current node using provided visitor
24654  *
24655  * Different nodes in the AST have different members (i.e. children). This method
24656  * recursively visits children using provided visitor.
24657  *
24658  * \param v Concrete constant visitor that will be used to recursively visit children
24659  *
24660  * \sa Ast::visit_children for example.
24661  */
24662  void visit_children(visitor::ConstVisitor& v) const override;
24663 
24664  /**
24665  * \brief accept (or visit) the current AST node using provided visitor
24666  *
24667  * Instead of visiting children of AST node, like Ast::visit_children,
24668  * accept allows to visit the current node itself using provided concrete
24669  * visitor.
24670  *
24671  * \param v Concrete visitor that will be used to recursively visit node
24672  *
24673  * \sa Ast::accept for example.
24674  */
24675  void accept(visitor::Visitor& v) override;
24676 
24677  /**
24678  * \copydoc accept(visitor::Visitor&)
24679  */
24680  void accept(visitor::ConstVisitor& v) const override;
24681 
24682  /// \}
24683 
24684 
24685 
24686  private:
24687  /**
24688  * \brief Set this object as parent for all the children
24689  *
24690  * This should be called in every object (with children) constructor
24691  * to set parents. Since it is called only in the constructors it
24692  * should not be virtual to avoid ambiguities (issue #295).
24693  */
24694  void set_parent_in_children();
24695 };
24696 
24697 /** @} */ // end of ast_class
24698 
24699 
24700 } // namespace ast
24701 } // namespace nmodl
24702 #endif // !NMODL_AST_PARAM_ASSIGN_HPP
24703 #ifndef NMODL_AST_STEPPED_HPP
24704 #define NMODL_AST_STEPPED_HPP
24705 
24706 
24707 namespace nmodl {
24708 namespace ast {
24709 
24710 /**
24711  * @addtogroup ast_class
24712  * @ingroup ast
24713  * @{
24714  */
24715 
24716 /**
24717  * \brief TODO
24718  *
24719  *
24720 */
24721 class Stepped : public Statement {
24722  private:
24723  /// TODO
24724  std::shared_ptr<Name> name;
24725  /// TODO
24727  /// TODO
24728  std::shared_ptr<Unit> unit;
24729  /// token with location information
24730  std::shared_ptr<ModToken> token;
24731 
24732  public:
24733 
24734  /// \name Ctor & dtor
24735  /// \{
24736 
24737  explicit Stepped(Name* name, NumberVector values, Unit* unit);
24738  explicit Stepped(const std::shared_ptr<Name>& name, const NumberVector& values, const std::shared_ptr<Unit>& unit);
24739  Stepped(const Stepped& obj);
24740 
24741 
24742  virtual ~Stepped() = default;
24743 
24744  /// \}
24745 
24746 
24747 
24748 
24749 
24750 
24751  /**
24752  * \brief Check if the ast node is an instance of ast::Stepped
24753  * \return true as object is of type ast::Stepped
24754  */
24755  bool is_stepped () const noexcept override {
24756  return true;
24757  }
24758 
24759  /**
24760  * \brief Return a copy of the current node
24761  *
24762  * Recursively make a new copy/clone of the current node including
24763  * all members and return a pointer to the node. This is used for
24764  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24765  * ast.
24766  *
24767  * @return pointer to the clone/copy of the current node
24768  */
24769  Stepped* clone() const override {
24770  return new Stepped(*this);
24771  }
24772 
24773  /// \name Getters
24774  /// \{
24775 
24776  /**
24777  * \brief Return type (ast::AstNodeType) of ast node
24778  *
24779  * Every node in the ast has a type defined in ast::AstNodeType and this
24780  * function is used to retrieve the same.
24781  *
24782  * \return ast node type i.e. ast::AstNodeType::STEPPED
24783  *
24784  * \sa Ast::get_node_type_name
24785  */
24786  AstNodeType get_node_type() const noexcept override {
24787  return AstNodeType::STEPPED;
24788  }
24789 
24790  /**
24791  * \brief Return type (ast::AstNodeType) of ast node as std::string
24792  *
24793  * Every node in the ast has a type defined in ast::AstNodeType.
24794  * This type name can be returned as a std::string for printing
24795  * node to text/json form.
24796  *
24797  * \return name of the node type as a string i.e. "Stepped"
24798  *
24799  * \sa Ast::get_node_name
24800  */
24801  std::string get_node_type_name() const noexcept override {
24802  return "Stepped";
24803  }
24804 
24805 
24806  /**
24807  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24808  */
24809  std::shared_ptr<Ast> get_shared_ptr() override {
24810  return std::static_pointer_cast<Stepped>(shared_from_this());
24811  }
24812 
24813  /**
24814  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24815  */
24816  std::shared_ptr<const Ast> get_shared_ptr() const override {
24817  return std::static_pointer_cast<const Stepped>(shared_from_this());
24818  }
24819 
24820  /**
24821  * \brief Return associated token for the current ast node
24822  *
24823  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
24824  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
24825  * nullptr to store in the nmodl::symtab::SymbolTable.
24826  *
24827  * \return pointer to token if exist otherwise nullptr
24828  */
24829  const ModToken* get_token() const noexcept override {
24830  return token.get();
24831  }
24832 
24833 
24834 
24835 
24836 
24837 
24838 
24839 
24840  /**
24841  * \brief Getter for member variable \ref Stepped.name
24842  */
24843  const std::shared_ptr<Name>& get_name() const noexcept {
24844  return name;
24845  }
24846 
24847 
24848 
24849 
24850 
24851 
24852 
24853  /**
24854  * \brief Getter for member variable \ref Stepped.values
24855  */
24856  const NumberVector& get_values() const noexcept {
24857  return values;
24858  }
24859 
24860 
24861 
24862 
24863 
24864 
24865 
24866  /**
24867  * \brief Getter for member variable \ref Stepped.unit
24868  */
24869  const std::shared_ptr<Unit>& get_unit() const noexcept {
24870  return unit;
24871  }
24872 
24873 
24874 
24875  /// \}
24876 
24877  /// \name Setters
24878  /// \{
24879 
24880 
24881  /**
24882  * \brief Set token for the current ast node
24883  */
24884  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
24885 
24886 
24887 
24888 
24889  /**
24890  * \brief Setter for member variable \ref Stepped.name (rvalue reference)
24891  */
24892  void set_name(std::shared_ptr<Name>&& name);
24893 
24894  /**
24895  * \brief Setter for member variable \ref Stepped.name
24896  */
24897  void set_name(const std::shared_ptr<Name>& name);
24898 
24899 
24900  /**
24901  * \brief Setter for member variable \ref Stepped.values (rvalue reference)
24902  */
24903  void set_values(NumberVector&& values);
24904 
24905  /**
24906  * \brief Setter for member variable \ref Stepped.values
24907  */
24908  void set_values(const NumberVector& values);
24909 
24910 
24911  /**
24912  * \brief Setter for member variable \ref Stepped.unit (rvalue reference)
24913  */
24914  void set_unit(std::shared_ptr<Unit>&& unit);
24915 
24916  /**
24917  * \brief Setter for member variable \ref Stepped.unit
24918  */
24919  void set_unit(const std::shared_ptr<Unit>& unit);
24920 
24921 
24922  /// \}
24923 
24924  /// \name Visitor
24925  /// \{
24926 
24927  /**
24928  * \brief visit children i.e. member variables of current node using provided visitor
24929  *
24930  * Different nodes in the AST have different members (i.e. children). This method
24931  * recursively visits children using provided visitor.
24932  *
24933  * \param v Concrete visitor that will be used to recursively visit children
24934  *
24935  * \sa Ast::visit_children for example.
24936  */
24937  void visit_children(visitor::Visitor& v) override;
24938 
24939  /**
24940  * \brief visit children i.e. member variables of current node using provided visitor
24941  *
24942  * Different nodes in the AST have different members (i.e. children). This method
24943  * recursively visits children using provided visitor.
24944  *
24945  * \param v Concrete constant visitor that will be used to recursively visit children
24946  *
24947  * \sa Ast::visit_children for example.
24948  */
24949  void visit_children(visitor::ConstVisitor& v) const override;
24950 
24951  /**
24952  * \brief accept (or visit) the current AST node using provided visitor
24953  *
24954  * Instead of visiting children of AST node, like Ast::visit_children,
24955  * accept allows to visit the current node itself using provided concrete
24956  * visitor.
24957  *
24958  * \param v Concrete visitor that will be used to recursively visit node
24959  *
24960  * \sa Ast::accept for example.
24961  */
24962  void accept(visitor::Visitor& v) override;
24963 
24964  /**
24965  * \copydoc accept(visitor::Visitor&)
24966  */
24967  void accept(visitor::ConstVisitor& v) const override;
24968 
24969  /// \}
24970 
24971 
24972 
24973  private:
24974  /**
24975  * \brief Set this object as parent for all the children
24976  *
24977  * This should be called in every object (with children) constructor
24978  * to set parents. Since it is called only in the constructors it
24979  * should not be virtual to avoid ambiguities (issue #295).
24980  */
24981  void set_parent_in_children();
24982 };
24983 
24984 /** @} */ // end of ast_class
24985 
24986 
24987 } // namespace ast
24988 } // namespace nmodl
24989 #endif // !NMODL_AST_STEPPED_HPP
24990 #ifndef NMODL_AST_INDEPENDENT_DEFINITION_HPP
24991 #define NMODL_AST_INDEPENDENT_DEFINITION_HPP
24992 
24993 
24994 namespace nmodl {
24995 namespace ast {
24996 
24997 /**
24998  * @addtogroup ast_class
24999  * @ingroup ast
25000  * @{
25001  */
25002 
25003 /**
25004  * \brief TODO
25005  *
25006  *
25007 */
25009  private:
25010  /// TODO
25011  std::shared_ptr<Boolean> sweep;
25012  /// TODO
25013  std::shared_ptr<Name> name;
25014  /// TODO
25015  std::shared_ptr<Number> from;
25016  /// TODO
25017  std::shared_ptr<Number> to;
25018  /// TODO
25019  std::shared_ptr<Integer> with;
25020  /// TODO
25021  std::shared_ptr<Number> start;
25022  /// TODO
25023  std::shared_ptr<Unit> unit;
25024  /// token with location information
25025  std::shared_ptr<ModToken> token;
25026 
25027  public:
25028 
25029  /// \name Ctor & dtor
25030  /// \{
25031 
25032  explicit IndependentDefinition(Boolean* sweep, Name* name, Number* from, Number* to, Integer* with, Number* start, Unit* unit);
25033  explicit IndependentDefinition(const std::shared_ptr<Boolean>& sweep, const std::shared_ptr<Name>& name, const std::shared_ptr<Number>& from, const std::shared_ptr<Number>& to, const std::shared_ptr<Integer>& with, const std::shared_ptr<Number>& start, const std::shared_ptr<Unit>& unit);
25035 
25036 
25037  virtual ~IndependentDefinition() = default;
25038 
25039  /// \}
25040 
25041 
25042 
25043 
25044 
25045 
25046  /**
25047  * \brief Check if the ast node is an instance of ast::IndependentDefinition
25048  * \return true as object is of type ast::IndependentDefinition
25049  */
25050  bool is_independent_definition () const noexcept override {
25051  return true;
25052  }
25053 
25054  /**
25055  * \brief Return a copy of the current node
25056  *
25057  * Recursively make a new copy/clone of the current node including
25058  * all members and return a pointer to the node. This is used for
25059  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25060  * ast.
25061  *
25062  * @return pointer to the clone/copy of the current node
25063  */
25064  IndependentDefinition* clone() const override {
25065  return new IndependentDefinition(*this);
25066  }
25067 
25068  /// \name Getters
25069  /// \{
25070 
25071  /**
25072  * \brief Return type (ast::AstNodeType) of ast node
25073  *
25074  * Every node in the ast has a type defined in ast::AstNodeType and this
25075  * function is used to retrieve the same.
25076  *
25077  * \return ast node type i.e. ast::AstNodeType::INDEPENDENT_DEFINITION
25078  *
25079  * \sa Ast::get_node_type_name
25080  */
25081  AstNodeType get_node_type() const noexcept override {
25083  }
25084 
25085  /**
25086  * \brief Return type (ast::AstNodeType) of ast node as std::string
25087  *
25088  * Every node in the ast has a type defined in ast::AstNodeType.
25089  * This type name can be returned as a std::string for printing
25090  * node to text/json form.
25091  *
25092  * \return name of the node type as a string i.e. "IndependentDefinition"
25093  *
25094  * \sa Ast::get_node_name
25095  */
25096  std::string get_node_type_name() const noexcept override {
25097  return "IndependentDefinition";
25098  }
25099 
25100 
25101  /**
25102  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25103  */
25104  std::shared_ptr<Ast> get_shared_ptr() override {
25105  return std::static_pointer_cast<IndependentDefinition>(shared_from_this());
25106  }
25107 
25108  /**
25109  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25110  */
25111  std::shared_ptr<const Ast> get_shared_ptr() const override {
25112  return std::static_pointer_cast<const IndependentDefinition>(shared_from_this());
25113  }
25114 
25115  /**
25116  * \brief Return associated token for the current ast node
25117  *
25118  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
25119  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
25120  * nullptr to store in the nmodl::symtab::SymbolTable.
25121  *
25122  * \return pointer to token if exist otherwise nullptr
25123  */
25124  const ModToken* get_token() const noexcept override {
25125  return token.get();
25126  }
25127 
25128 
25129 
25130 
25131 
25132 
25133 
25134 
25135  /**
25136  * \brief Getter for member variable \ref IndependentDefinition.sweep
25137  */
25138  const std::shared_ptr<Boolean>& get_sweep() const noexcept {
25139  return sweep;
25140  }
25141 
25142 
25143 
25144 
25145 
25146 
25147 
25148  /**
25149  * \brief Getter for member variable \ref IndependentDefinition.name
25150  */
25151  const std::shared_ptr<Name>& get_name() const noexcept {
25152  return name;
25153  }
25154 
25155 
25156 
25157 
25158 
25159 
25160 
25161  /**
25162  * \brief Getter for member variable \ref IndependentDefinition.from
25163  */
25164  const std::shared_ptr<Number>& get_from() const noexcept {
25165  return from;
25166  }
25167 
25168 
25169 
25170 
25171 
25172 
25173 
25174  /**
25175  * \brief Getter for member variable \ref IndependentDefinition.to
25176  */
25177  const std::shared_ptr<Number>& get_to() const noexcept {
25178  return to;
25179  }
25180 
25181 
25182 
25183 
25184 
25185 
25186 
25187  /**
25188  * \brief Getter for member variable \ref IndependentDefinition.with
25189  */
25190  const std::shared_ptr<Integer>& get_with() const noexcept {
25191  return with;
25192  }
25193 
25194 
25195 
25196 
25197 
25198 
25199 
25200  /**
25201  * \brief Getter for member variable \ref IndependentDefinition.start
25202  */
25203  const std::shared_ptr<Number>& get_start() const noexcept {
25204  return start;
25205  }
25206 
25207 
25208 
25209 
25210 
25211 
25212 
25213  /**
25214  * \brief Getter for member variable \ref IndependentDefinition.unit
25215  */
25216  const std::shared_ptr<Unit>& get_unit() const noexcept {
25217  return unit;
25218  }
25219 
25220 
25221 
25222  /// \}
25223 
25224  /// \name Setters
25225  /// \{
25226 
25227 
25228  /**
25229  * \brief Set token for the current ast node
25230  */
25231  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
25232 
25233 
25234 
25235 
25236  /**
25237  * \brief Setter for member variable \ref IndependentDefinition.sweep (rvalue reference)
25238  */
25239  void set_sweep(std::shared_ptr<Boolean>&& sweep);
25240 
25241  /**
25242  * \brief Setter for member variable \ref IndependentDefinition.sweep
25243  */
25244  void set_sweep(const std::shared_ptr<Boolean>& sweep);
25245 
25246 
25247  /**
25248  * \brief Setter for member variable \ref IndependentDefinition.name (rvalue reference)
25249  */
25250  void set_name(std::shared_ptr<Name>&& name);
25251 
25252  /**
25253  * \brief Setter for member variable \ref IndependentDefinition.name
25254  */
25255  void set_name(const std::shared_ptr<Name>& name);
25256 
25257 
25258  /**
25259  * \brief Setter for member variable \ref IndependentDefinition.from (rvalue reference)
25260  */
25261  void set_from(std::shared_ptr<Number>&& from);
25262 
25263  /**
25264  * \brief Setter for member variable \ref IndependentDefinition.from
25265  */
25266  void set_from(const std::shared_ptr<Number>& from);
25267 
25268 
25269  /**
25270  * \brief Setter for member variable \ref IndependentDefinition.to (rvalue reference)
25271  */
25272  void set_to(std::shared_ptr<Number>&& to);
25273 
25274  /**
25275  * \brief Setter for member variable \ref IndependentDefinition.to
25276  */
25277  void set_to(const std::shared_ptr<Number>& to);
25278 
25279 
25280  /**
25281  * \brief Setter for member variable \ref IndependentDefinition.with (rvalue reference)
25282  */
25283  void set_with(std::shared_ptr<Integer>&& with);
25284 
25285  /**
25286  * \brief Setter for member variable \ref IndependentDefinition.with
25287  */
25288  void set_with(const std::shared_ptr<Integer>& with);
25289 
25290 
25291  /**
25292  * \brief Setter for member variable \ref IndependentDefinition.start (rvalue reference)
25293  */
25294  void set_start(std::shared_ptr<Number>&& start);
25295 
25296  /**
25297  * \brief Setter for member variable \ref IndependentDefinition.start
25298  */
25299  void set_start(const std::shared_ptr<Number>& start);
25300 
25301 
25302  /**
25303  * \brief Setter for member variable \ref IndependentDefinition.unit (rvalue reference)
25304  */
25305  void set_unit(std::shared_ptr<Unit>&& unit);
25306 
25307  /**
25308  * \brief Setter for member variable \ref IndependentDefinition.unit
25309  */
25310  void set_unit(const std::shared_ptr<Unit>& unit);
25311 
25312 
25313  /// \}
25314 
25315  /// \name Visitor
25316  /// \{
25317 
25318  /**
25319  * \brief visit children i.e. member variables of current node using provided visitor
25320  *
25321  * Different nodes in the AST have different members (i.e. children). This method
25322  * recursively visits children using provided visitor.
25323  *
25324  * \param v Concrete visitor that will be used to recursively visit children
25325  *
25326  * \sa Ast::visit_children for example.
25327  */
25328  void visit_children(visitor::Visitor& v) override;
25329 
25330  /**
25331  * \brief visit children i.e. member variables of current node using provided visitor
25332  *
25333  * Different nodes in the AST have different members (i.e. children). This method
25334  * recursively visits children using provided visitor.
25335  *
25336  * \param v Concrete constant visitor that will be used to recursively visit children
25337  *
25338  * \sa Ast::visit_children for example.
25339  */
25340  void visit_children(visitor::ConstVisitor& v) const override;
25341 
25342  /**
25343  * \brief accept (or visit) the current AST node using provided visitor
25344  *
25345  * Instead of visiting children of AST node, like Ast::visit_children,
25346  * accept allows to visit the current node itself using provided concrete
25347  * visitor.
25348  *
25349  * \param v Concrete visitor that will be used to recursively visit node
25350  *
25351  * \sa Ast::accept for example.
25352  */
25353  void accept(visitor::Visitor& v) override;
25354 
25355  /**
25356  * \copydoc accept(visitor::Visitor&)
25357  */
25358  void accept(visitor::ConstVisitor& v) const override;
25359 
25360  /// \}
25361 
25362 
25363 
25364  private:
25365  /**
25366  * \brief Set this object as parent for all the children
25367  *
25368  * This should be called in every object (with children) constructor
25369  * to set parents. Since it is called only in the constructors it
25370  * should not be virtual to avoid ambiguities (issue #295).
25371  */
25372  void set_parent_in_children();
25373 };
25374 
25375 /** @} */ // end of ast_class
25376 
25377 
25378 } // namespace ast
25379 } // namespace nmodl
25380 #endif // !NMODL_AST_INDEPENDENT_DEFINITION_HPP
25381 #ifndef NMODL_AST_ASSIGNED_DEFINITION_HPP
25382 #define NMODL_AST_ASSIGNED_DEFINITION_HPP
25383 
25384 
25385 namespace nmodl {
25386 namespace ast {
25387 
25388 /**
25389  * @addtogroup ast_class
25390  * @ingroup ast
25391  * @{
25392  */
25393 
25394 /**
25395  * \brief Represents a statement in `ASSIGNED` or `STATE` block
25396  *
25397  *
25398 */
25400  private:
25401  /// Name of the variable
25402  std::shared_ptr<Identifier> name;
25403  /// Length in case of array
25404  std::shared_ptr<Integer> length;
25405  /// TODO
25406  std::shared_ptr<Number> from;
25407  /// TODO
25408  std::shared_ptr<Number> to;
25409  /// TODO
25410  std::shared_ptr<Number> start;
25411  /// TODO
25412  std::shared_ptr<Unit> unit;
25413  /// TODO
25414  std::shared_ptr<Double> abstol;
25415  /// token with location information
25416  std::shared_ptr<ModToken> token;
25417 
25418  public:
25419 
25420  /// \name Ctor & dtor
25421  /// \{
25422 
25423  explicit AssignedDefinition(Identifier* name, Integer* length, Number* from, Number* to, Number* start, Unit* unit, Double* abstol);
25424  explicit AssignedDefinition(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Integer>& length, const std::shared_ptr<Number>& from, const std::shared_ptr<Number>& to, const std::shared_ptr<Number>& start, const std::shared_ptr<Unit>& unit, const std::shared_ptr<Double>& abstol);
25426 
25427 
25428  virtual ~AssignedDefinition() = default;
25429 
25430  /// \}
25431 
25432 
25433 
25434 
25435 
25436 
25437  /**
25438  * \brief Check if the ast node is an instance of ast::AssignedDefinition
25439  * \return true as object is of type ast::AssignedDefinition
25440  */
25441  bool is_assigned_definition () const noexcept override {
25442  return true;
25443  }
25444 
25445  /**
25446  * \brief Return a copy of the current node
25447  *
25448  * Recursively make a new copy/clone of the current node including
25449  * all members and return a pointer to the node. This is used for
25450  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25451  * ast.
25452  *
25453  * @return pointer to the clone/copy of the current node
25454  */
25455  AssignedDefinition* clone() const override {
25456  return new AssignedDefinition(*this);
25457  }
25458 
25459  /// \name Getters
25460  /// \{
25461 
25462  /**
25463  * \brief Return type (ast::AstNodeType) of ast node
25464  *
25465  * Every node in the ast has a type defined in ast::AstNodeType and this
25466  * function is used to retrieve the same.
25467  *
25468  * \return ast node type i.e. ast::AstNodeType::ASSIGNED_DEFINITION
25469  *
25470  * \sa Ast::get_node_type_name
25471  */
25472  AstNodeType get_node_type() const noexcept override {
25474  }
25475 
25476  /**
25477  * \brief Return type (ast::AstNodeType) of ast node as std::string
25478  *
25479  * Every node in the ast has a type defined in ast::AstNodeType.
25480  * This type name can be returned as a std::string for printing
25481  * node to text/json form.
25482  *
25483  * \return name of the node type as a string i.e. "AssignedDefinition"
25484  *
25485  * \sa Ast::get_node_name
25486  */
25487  std::string get_node_type_name() const noexcept override {
25488  return "AssignedDefinition";
25489  }
25490 
25491 
25492  /**
25493  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25494  */
25495  std::shared_ptr<Ast> get_shared_ptr() override {
25496  return std::static_pointer_cast<AssignedDefinition>(shared_from_this());
25497  }
25498 
25499  /**
25500  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25501  */
25502  std::shared_ptr<const Ast> get_shared_ptr() const override {
25503  return std::static_pointer_cast<const AssignedDefinition>(shared_from_this());
25504  }
25505 
25506  /**
25507  * \brief Return associated token for the current ast node
25508  *
25509  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
25510  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
25511  * nullptr to store in the nmodl::symtab::SymbolTable.
25512  *
25513  * \return pointer to token if exist otherwise nullptr
25514  */
25515  const ModToken* get_token() const noexcept override {
25516  return token.get();
25517  }
25518 
25519 
25520 
25521 
25522 
25523 
25524 /**
25525  * \brief Return name of the node
25526  *
25527  * Some ast nodes have a member marked designated as node name. For example,
25528  * in case of this ast::Identifier has name designated as a
25529  * node name.
25530  *
25531  * @return name of the node as std::string
25532  *
25533  * \sa Ast::get_node_type_name
25534  */
25535 std::string get_node_name() const override;
25536 
25537 
25538  /**
25539  * \brief Getter for member variable \ref AssignedDefinition.name
25540  */
25541  const std::shared_ptr<Identifier>& get_name() const noexcept {
25542  return name;
25543  }
25544 
25545 
25546 
25547 
25548 
25549 
25550 
25551  /**
25552  * \brief Getter for member variable \ref AssignedDefinition.length
25553  */
25554  const std::shared_ptr<Integer>& get_length() const noexcept {
25555  return length;
25556  }
25557 
25558 
25559 
25560 
25561 
25562 
25563 
25564  /**
25565  * \brief Getter for member variable \ref AssignedDefinition.from
25566  */
25567  const std::shared_ptr<Number>& get_from() const noexcept {
25568  return from;
25569  }
25570 
25571 
25572 
25573 
25574 
25575 
25576 
25577  /**
25578  * \brief Getter for member variable \ref AssignedDefinition.to
25579  */
25580  const std::shared_ptr<Number>& get_to() const noexcept {
25581  return to;
25582  }
25583 
25584 
25585 
25586 
25587 
25588 
25589 
25590  /**
25591  * \brief Getter for member variable \ref AssignedDefinition.start
25592  */
25593  const std::shared_ptr<Number>& get_start() const noexcept {
25594  return start;
25595  }
25596 
25597 
25598 
25599 
25600 
25601 
25602 
25603  /**
25604  * \brief Getter for member variable \ref AssignedDefinition.unit
25605  */
25606  const std::shared_ptr<Unit>& get_unit() const noexcept {
25607  return unit;
25608  }
25609 
25610 
25611 
25612 
25613 
25614 
25615 
25616  /**
25617  * \brief Getter for member variable \ref AssignedDefinition.abstol
25618  */
25619  const std::shared_ptr<Double>& get_abstol() const noexcept {
25620  return abstol;
25621  }
25622 
25623 
25624 
25625  /// \}
25626 
25627  /// \name Setters
25628  /// \{
25629 
25630 
25631  /**
25632  * \brief Set token for the current ast node
25633  */
25634  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
25635 
25636 
25637 
25638 
25639  /**
25640  * \brief Setter for member variable \ref AssignedDefinition.name (rvalue reference)
25641  */
25642  void set_name(std::shared_ptr<Identifier>&& name);
25643 
25644  /**
25645  * \brief Setter for member variable \ref AssignedDefinition.name
25646  */
25647  void set_name(const std::shared_ptr<Identifier>& name);
25648 
25649 
25650  /**
25651  * \brief Setter for member variable \ref AssignedDefinition.length (rvalue reference)
25652  */
25653  void set_length(std::shared_ptr<Integer>&& length);
25654 
25655  /**
25656  * \brief Setter for member variable \ref AssignedDefinition.length
25657  */
25658  void set_length(const std::shared_ptr<Integer>& length);
25659 
25660 
25661  /**
25662  * \brief Setter for member variable \ref AssignedDefinition.from (rvalue reference)
25663  */
25664  void set_from(std::shared_ptr<Number>&& from);
25665 
25666  /**
25667  * \brief Setter for member variable \ref AssignedDefinition.from
25668  */
25669  void set_from(const std::shared_ptr<Number>& from);
25670 
25671 
25672  /**
25673  * \brief Setter for member variable \ref AssignedDefinition.to (rvalue reference)
25674  */
25675  void set_to(std::shared_ptr<Number>&& to);
25676 
25677  /**
25678  * \brief Setter for member variable \ref AssignedDefinition.to
25679  */
25680  void set_to(const std::shared_ptr<Number>& to);
25681 
25682 
25683  /**
25684  * \brief Setter for member variable \ref AssignedDefinition.start (rvalue reference)
25685  */
25686  void set_start(std::shared_ptr<Number>&& start);
25687 
25688  /**
25689  * \brief Setter for member variable \ref AssignedDefinition.start
25690  */
25691  void set_start(const std::shared_ptr<Number>& start);
25692 
25693 
25694  /**
25695  * \brief Setter for member variable \ref AssignedDefinition.unit (rvalue reference)
25696  */
25697  void set_unit(std::shared_ptr<Unit>&& unit);
25698 
25699  /**
25700  * \brief Setter for member variable \ref AssignedDefinition.unit
25701  */
25702  void set_unit(const std::shared_ptr<Unit>& unit);
25703 
25704 
25705  /**
25706  * \brief Setter for member variable \ref AssignedDefinition.abstol (rvalue reference)
25707  */
25708  void set_abstol(std::shared_ptr<Double>&& abstol);
25709 
25710  /**
25711  * \brief Setter for member variable \ref AssignedDefinition.abstol
25712  */
25713  void set_abstol(const std::shared_ptr<Double>& abstol);
25714 
25715 
25716  /// \}
25717 
25718  /// \name Visitor
25719  /// \{
25720 
25721  /**
25722  * \brief visit children i.e. member variables of current node using provided visitor
25723  *
25724  * Different nodes in the AST have different members (i.e. children). This method
25725  * recursively visits children using provided visitor.
25726  *
25727  * \param v Concrete visitor that will be used to recursively visit children
25728  *
25729  * \sa Ast::visit_children for example.
25730  */
25731  void visit_children(visitor::Visitor& v) override;
25732 
25733  /**
25734  * \brief visit children i.e. member variables of current node using provided visitor
25735  *
25736  * Different nodes in the AST have different members (i.e. children). This method
25737  * recursively visits children using provided visitor.
25738  *
25739  * \param v Concrete constant visitor that will be used to recursively visit children
25740  *
25741  * \sa Ast::visit_children for example.
25742  */
25743  void visit_children(visitor::ConstVisitor& v) const override;
25744 
25745  /**
25746  * \brief accept (or visit) the current AST node using provided visitor
25747  *
25748  * Instead of visiting children of AST node, like Ast::visit_children,
25749  * accept allows to visit the current node itself using provided concrete
25750  * visitor.
25751  *
25752  * \param v Concrete visitor that will be used to recursively visit node
25753  *
25754  * \sa Ast::accept for example.
25755  */
25756  void accept(visitor::Visitor& v) override;
25757 
25758  /**
25759  * \copydoc accept(visitor::Visitor&)
25760  */
25761  void accept(visitor::ConstVisitor& v) const override;
25762 
25763  /// \}
25764 
25765 
25766 
25767  private:
25768  /**
25769  * \brief Set this object as parent for all the children
25770  *
25771  * This should be called in every object (with children) constructor
25772  * to set parents. Since it is called only in the constructors it
25773  * should not be virtual to avoid ambiguities (issue #295).
25774  */
25775  void set_parent_in_children();
25776 };
25777 
25778 /** @} */ // end of ast_class
25779 
25780 
25781 } // namespace ast
25782 } // namespace nmodl
25783 #endif // !NMODL_AST_ASSIGNED_DEFINITION_HPP
25784 #ifndef NMODL_AST_PLOT_DECLARATION_HPP
25785 #define NMODL_AST_PLOT_DECLARATION_HPP
25786 
25787 
25788 namespace nmodl {
25789 namespace ast {
25790 
25791 /**
25792  * @addtogroup ast_class
25793  * @ingroup ast
25794  * @{
25795  */
25796 
25797 /**
25798  * \brief TODO
25799  *
25800  *
25801 */
25802 class PlotDeclaration : public Statement {
25803  private:
25804  /// TODO
25806  /// TODO
25807  std::shared_ptr<PlotVar> name;
25808  /// token with location information
25809  std::shared_ptr<ModToken> token;
25810 
25811  public:
25812 
25813  /// \name Ctor & dtor
25814  /// \{
25815 
25816  explicit PlotDeclaration(PlotVarVector variables, PlotVar* name);
25817  explicit PlotDeclaration(const PlotVarVector& variables, const std::shared_ptr<PlotVar>& name);
25818  PlotDeclaration(const PlotDeclaration& obj);
25819 
25820 
25821  virtual ~PlotDeclaration() = default;
25822 
25823  /// \}
25824 
25825 
25826 
25827 
25828 
25829 
25830  /**
25831  * \brief Check if the ast node is an instance of ast::PlotDeclaration
25832  * \return true as object is of type ast::PlotDeclaration
25833  */
25834  bool is_plot_declaration () const noexcept override {
25835  return true;
25836  }
25837 
25838  /**
25839  * \brief Return a copy of the current node
25840  *
25841  * Recursively make a new copy/clone of the current node including
25842  * all members and return a pointer to the node. This is used for
25843  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25844  * ast.
25845  *
25846  * @return pointer to the clone/copy of the current node
25847  */
25848  PlotDeclaration* clone() const override {
25849  return new PlotDeclaration(*this);
25850  }
25851 
25852  /// \name Getters
25853  /// \{
25854 
25855  /**
25856  * \brief Return type (ast::AstNodeType) of ast node
25857  *
25858  * Every node in the ast has a type defined in ast::AstNodeType and this
25859  * function is used to retrieve the same.
25860  *
25861  * \return ast node type i.e. ast::AstNodeType::PLOT_DECLARATION
25862  *
25863  * \sa Ast::get_node_type_name
25864  */
25865  AstNodeType get_node_type() const noexcept override {
25867  }
25868 
25869  /**
25870  * \brief Return type (ast::AstNodeType) of ast node as std::string
25871  *
25872  * Every node in the ast has a type defined in ast::AstNodeType.
25873  * This type name can be returned as a std::string for printing
25874  * node to text/json form.
25875  *
25876  * \return name of the node type as a string i.e. "PlotDeclaration"
25877  *
25878  * \sa Ast::get_node_name
25879  */
25880  std::string get_node_type_name() const noexcept override {
25881  return "PlotDeclaration";
25882  }
25883 
25884  /**
25885  * \brief Return NMODL statement of ast node as std::string
25886  *
25887  * Every node is related to a special statement in the NMODL. This
25888  * statement can be returned as a std::string for printing to
25889  * text/json form.
25890  *
25891  * \return name of the statement as a string i.e. "PLOT "
25892  *
25893  * \sa Ast::get_nmodl_name
25894  */
25895  std::string get_nmodl_name() const noexcept override {
25896  return "PLOT ";
25897  }
25898 
25899  /**
25900  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25901  */
25902  std::shared_ptr<Ast> get_shared_ptr() override {
25903  return std::static_pointer_cast<PlotDeclaration>(shared_from_this());
25904  }
25905 
25906  /**
25907  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25908  */
25909  std::shared_ptr<const Ast> get_shared_ptr() const override {
25910  return std::static_pointer_cast<const PlotDeclaration>(shared_from_this());
25911  }
25912 
25913  /**
25914  * \brief Return associated token for the current ast node
25915  *
25916  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
25917  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
25918  * nullptr to store in the nmodl::symtab::SymbolTable.
25919  *
25920  * \return pointer to token if exist otherwise nullptr
25921  */
25922  const ModToken* get_token() const noexcept override {
25923  return token.get();
25924  }
25925 
25926 
25927 
25928 
25929 
25930 
25931 
25932 
25933  /**
25934  * \brief Getter for member variable \ref PlotDeclaration.variables
25935  */
25936  const PlotVarVector& get_variables() const noexcept {
25937  return variables;
25938  }
25939 
25940 
25941 
25942 
25943 
25944 
25945 
25946  /**
25947  * \brief Getter for member variable \ref PlotDeclaration.name
25948  */
25949  const std::shared_ptr<PlotVar>& get_name() const noexcept {
25950  return name;
25951  }
25952 
25953 
25954 
25955  /// \}
25956 
25957  /// \name Setters
25958  /// \{
25959 
25960 
25961  /**
25962  * \brief Set token for the current ast node
25963  */
25964  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
25965 
25966 
25967 
25968 
25969  /**
25970  * \brief Setter for member variable \ref PlotDeclaration.variables (rvalue reference)
25971  */
25972  void set_variables(PlotVarVector&& variables);
25973 
25974  /**
25975  * \brief Setter for member variable \ref PlotDeclaration.variables
25976  */
25977  void set_variables(const PlotVarVector& variables);
25978 
25979 
25980  /**
25981  * \brief Setter for member variable \ref PlotDeclaration.name (rvalue reference)
25982  */
25983  void set_name(std::shared_ptr<PlotVar>&& name);
25984 
25985  /**
25986  * \brief Setter for member variable \ref PlotDeclaration.name
25987  */
25988  void set_name(const std::shared_ptr<PlotVar>& name);
25989 
25990 
25991  /// \}
25992 
25993  /// \name Visitor
25994  /// \{
25995 
25996  /**
25997  * \brief visit children i.e. member variables of current node using provided visitor
25998  *
25999  * Different nodes in the AST have different members (i.e. children). This method
26000  * recursively visits children using provided visitor.
26001  *
26002  * \param v Concrete visitor that will be used to recursively visit children
26003  *
26004  * \sa Ast::visit_children for example.
26005  */
26006  void visit_children(visitor::Visitor& v) override;
26007 
26008  /**
26009  * \brief visit children i.e. member variables of current node using provided visitor
26010  *
26011  * Different nodes in the AST have different members (i.e. children). This method
26012  * recursively visits children using provided visitor.
26013  *
26014  * \param v Concrete constant visitor that will be used to recursively visit children
26015  *
26016  * \sa Ast::visit_children for example.
26017  */
26018  void visit_children(visitor::ConstVisitor& v) const override;
26019 
26020  /**
26021  * \brief accept (or visit) the current AST node using provided visitor
26022  *
26023  * Instead of visiting children of AST node, like Ast::visit_children,
26024  * accept allows to visit the current node itself using provided concrete
26025  * visitor.
26026  *
26027  * \param v Concrete visitor that will be used to recursively visit node
26028  *
26029  * \sa Ast::accept for example.
26030  */
26031  void accept(visitor::Visitor& v) override;
26032 
26033  /**
26034  * \copydoc accept(visitor::Visitor&)
26035  */
26036  void accept(visitor::ConstVisitor& v) const override;
26037 
26038  /// \}
26039 
26040 
26041 
26042  private:
26043  /**
26044  * \brief Set this object as parent for all the children
26045  *
26046  * This should be called in every object (with children) constructor
26047  * to set parents. Since it is called only in the constructors it
26048  * should not be virtual to avoid ambiguities (issue #295).
26049  */
26050  void set_parent_in_children();
26051 };
26052 
26053 /** @} */ // end of ast_class
26054 
26055 
26056 } // namespace ast
26057 } // namespace nmodl
26058 #endif // !NMODL_AST_PLOT_DECLARATION_HPP
26059 #ifndef NMODL_AST_CONDUCTANCE_HINT_HPP
26060 #define NMODL_AST_CONDUCTANCE_HINT_HPP
26061 
26062 
26063 namespace nmodl {
26064 namespace ast {
26065 
26066 /**
26067  * @addtogroup ast_class
26068  * @ingroup ast
26069  * @{
26070  */
26071 
26072 /**
26073  * \brief Represents `CONDUCTANCE` statement in NMODL
26074  *
26075  * If `I/V` relation in the `BREAKPOINT` block is ohomic then one can
26076  * specify `CONDUCTANCE` hint for optimised code generation:
26077  *
26078  * \code{.mod}
26079  * CONDUCTANCE g USEION I
26080  * \endcode
26081  *
26082  * \sa nmodl::visitor::SympyConductanceVisitor
26083  *
26084 */
26085 class ConductanceHint : public Statement {
26086  private:
26087  /// Conductance variable
26088  std::shared_ptr<Name> conductance;
26089  /// Ion name
26090  std::shared_ptr<Name> ion;
26091  /// token with location information
26092  std::shared_ptr<ModToken> token;
26093 
26094  public:
26095 
26096  /// \name Ctor & dtor
26097  /// \{
26098 
26099  explicit ConductanceHint(Name* conductance, Name* ion);
26100  explicit ConductanceHint(const std::shared_ptr<Name>& conductance, const std::shared_ptr<Name>& ion);
26101  ConductanceHint(const ConductanceHint& obj);
26102 
26103 
26104  virtual ~ConductanceHint() = default;
26105 
26106  /// \}
26107 
26108 
26109 
26110 
26111 
26112 
26113  /**
26114  * \brief Check if the ast node is an instance of ast::ConductanceHint
26115  * \return true as object is of type ast::ConductanceHint
26116  */
26117  bool is_conductance_hint () const noexcept override {
26118  return true;
26119  }
26120 
26121  /**
26122  * \brief Return a copy of the current node
26123  *
26124  * Recursively make a new copy/clone of the current node including
26125  * all members and return a pointer to the node. This is used for
26126  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26127  * ast.
26128  *
26129  * @return pointer to the clone/copy of the current node
26130  */
26131  ConductanceHint* clone() const override {
26132  return new ConductanceHint(*this);
26133  }
26134 
26135  /// \name Getters
26136  /// \{
26137 
26138  /**
26139  * \brief Return type (ast::AstNodeType) of ast node
26140  *
26141  * Every node in the ast has a type defined in ast::AstNodeType and this
26142  * function is used to retrieve the same.
26143  *
26144  * \return ast node type i.e. ast::AstNodeType::CONDUCTANCE_HINT
26145  *
26146  * \sa Ast::get_node_type_name
26147  */
26148  AstNodeType get_node_type() const noexcept override {
26150  }
26151 
26152  /**
26153  * \brief Return type (ast::AstNodeType) of ast node as std::string
26154  *
26155  * Every node in the ast has a type defined in ast::AstNodeType.
26156  * This type name can be returned as a std::string for printing
26157  * node to text/json form.
26158  *
26159  * \return name of the node type as a string i.e. "ConductanceHint"
26160  *
26161  * \sa Ast::get_node_name
26162  */
26163  std::string get_node_type_name() const noexcept override {
26164  return "ConductanceHint";
26165  }
26166 
26167  /**
26168  * \brief Return NMODL statement of ast node as std::string
26169  *
26170  * Every node is related to a special statement in the NMODL. This
26171  * statement can be returned as a std::string for printing to
26172  * text/json form.
26173  *
26174  * \return name of the statement as a string i.e. "CONDUCTANCE "
26175  *
26176  * \sa Ast::get_nmodl_name
26177  */
26178  std::string get_nmodl_name() const noexcept override {
26179  return "CONDUCTANCE ";
26180  }
26181 
26182  /**
26183  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26184  */
26185  std::shared_ptr<Ast> get_shared_ptr() override {
26186  return std::static_pointer_cast<ConductanceHint>(shared_from_this());
26187  }
26188 
26189  /**
26190  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26191  */
26192  std::shared_ptr<const Ast> get_shared_ptr() const override {
26193  return std::static_pointer_cast<const ConductanceHint>(shared_from_this());
26194  }
26195 
26196  /**
26197  * \brief Return associated token for the current ast node
26198  *
26199  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
26200  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
26201  * nullptr to store in the nmodl::symtab::SymbolTable.
26202  *
26203  * \return pointer to token if exist otherwise nullptr
26204  */
26205  const ModToken* get_token() const noexcept override {
26206  return token.get();
26207  }
26208 
26209 
26210 
26211 
26212 
26213 
26214 
26215 
26216  /**
26217  * \brief Getter for member variable \ref ConductanceHint.conductance
26218  */
26219  const std::shared_ptr<Name>& get_conductance() const noexcept {
26220  return conductance;
26221  }
26222 
26223 
26224 
26225 
26226 
26227 
26228 
26229  /**
26230  * \brief Getter for member variable \ref ConductanceHint.ion
26231  */
26232  const std::shared_ptr<Name>& get_ion() const noexcept {
26233  return ion;
26234  }
26235 
26236 
26237 
26238  /// \}
26239 
26240  /// \name Setters
26241  /// \{
26242 
26243 
26244  /**
26245  * \brief Set token for the current ast node
26246  */
26247  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
26248 
26249 
26250 
26251 
26252  /**
26253  * \brief Setter for member variable \ref ConductanceHint.conductance (rvalue reference)
26254  */
26255  void set_conductance(std::shared_ptr<Name>&& conductance);
26256 
26257  /**
26258  * \brief Setter for member variable \ref ConductanceHint.conductance
26259  */
26260  void set_conductance(const std::shared_ptr<Name>& conductance);
26261 
26262 
26263  /**
26264  * \brief Setter for member variable \ref ConductanceHint.ion (rvalue reference)
26265  */
26266  void set_ion(std::shared_ptr<Name>&& ion);
26267 
26268  /**
26269  * \brief Setter for member variable \ref ConductanceHint.ion
26270  */
26271  void set_ion(const std::shared_ptr<Name>& ion);
26272 
26273 
26274  /// \}
26275 
26276  /// \name Visitor
26277  /// \{
26278 
26279  /**
26280  * \brief visit children i.e. member variables of current node using provided visitor
26281  *
26282  * Different nodes in the AST have different members (i.e. children). This method
26283  * recursively visits children using provided visitor.
26284  *
26285  * \param v Concrete visitor that will be used to recursively visit children
26286  *
26287  * \sa Ast::visit_children for example.
26288  */
26289  void visit_children(visitor::Visitor& v) override;
26290 
26291  /**
26292  * \brief visit children i.e. member variables of current node using provided visitor
26293  *
26294  * Different nodes in the AST have different members (i.e. children). This method
26295  * recursively visits children using provided visitor.
26296  *
26297  * \param v Concrete constant visitor that will be used to recursively visit children
26298  *
26299  * \sa Ast::visit_children for example.
26300  */
26301  void visit_children(visitor::ConstVisitor& v) const override;
26302 
26303  /**
26304  * \brief accept (or visit) the current AST node using provided visitor
26305  *
26306  * Instead of visiting children of AST node, like Ast::visit_children,
26307  * accept allows to visit the current node itself using provided concrete
26308  * visitor.
26309  *
26310  * \param v Concrete visitor that will be used to recursively visit node
26311  *
26312  * \sa Ast::accept for example.
26313  */
26314  void accept(visitor::Visitor& v) override;
26315 
26316  /**
26317  * \copydoc accept(visitor::Visitor&)
26318  */
26319  void accept(visitor::ConstVisitor& v) const override;
26320 
26321  /// \}
26322 
26323 
26324 
26325  private:
26326  /**
26327  * \brief Set this object as parent for all the children
26328  *
26329  * This should be called in every object (with children) constructor
26330  * to set parents. Since it is called only in the constructors it
26331  * should not be virtual to avoid ambiguities (issue #295).
26332  */
26333  void set_parent_in_children();
26334 };
26335 
26336 /** @} */ // end of ast_class
26337 
26338 
26339 } // namespace ast
26340 } // namespace nmodl
26341 #endif // !NMODL_AST_CONDUCTANCE_HINT_HPP
26342 #ifndef NMODL_AST_EXPRESSION_STATEMENT_HPP
26343 #define NMODL_AST_EXPRESSION_STATEMENT_HPP
26344 
26345 
26346 namespace nmodl {
26347 namespace ast {
26348 
26349 /**
26350  * @addtogroup ast_class
26351  * @ingroup ast
26352  * @{
26353  */
26354 
26355 /**
26356  * \brief TODO
26357  *
26358  *
26359 */
26361  private:
26362  /// TODO
26363  std::shared_ptr<Expression> expression;
26364  /// token with location information
26365  std::shared_ptr<ModToken> token;
26366 
26367  public:
26368 
26369  /// \name Ctor & dtor
26370  /// \{
26371 
26372  explicit ExpressionStatement(Expression* expression);
26373  explicit ExpressionStatement(const std::shared_ptr<Expression>& expression);
26375 
26376 
26377  virtual ~ExpressionStatement() = default;
26378 
26379  /// \}
26380 
26381 
26382 
26383 
26384 
26385 
26386  /**
26387  * \brief Check if the ast node is an instance of ast::ExpressionStatement
26388  * \return true as object is of type ast::ExpressionStatement
26389  */
26390  bool is_expression_statement () const noexcept override {
26391  return true;
26392  }
26393 
26394  /**
26395  * \brief Return a copy of the current node
26396  *
26397  * Recursively make a new copy/clone of the current node including
26398  * all members and return a pointer to the node. This is used for
26399  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26400  * ast.
26401  *
26402  * @return pointer to the clone/copy of the current node
26403  */
26404  ExpressionStatement* clone() const override {
26405  return new ExpressionStatement(*this);
26406  }
26407 
26408  /// \name Getters
26409  /// \{
26410 
26411  /**
26412  * \brief Return type (ast::AstNodeType) of ast node
26413  *
26414  * Every node in the ast has a type defined in ast::AstNodeType and this
26415  * function is used to retrieve the same.
26416  *
26417  * \return ast node type i.e. ast::AstNodeType::EXPRESSION_STATEMENT
26418  *
26419  * \sa Ast::get_node_type_name
26420  */
26421  AstNodeType get_node_type() const noexcept override {
26423  }
26424 
26425  /**
26426  * \brief Return type (ast::AstNodeType) of ast node as std::string
26427  *
26428  * Every node in the ast has a type defined in ast::AstNodeType.
26429  * This type name can be returned as a std::string for printing
26430  * node to text/json form.
26431  *
26432  * \return name of the node type as a string i.e. "ExpressionStatement"
26433  *
26434  * \sa Ast::get_node_name
26435  */
26436  std::string get_node_type_name() const noexcept override {
26437  return "ExpressionStatement";
26438  }
26439 
26440 
26441  /**
26442  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26443  */
26444  std::shared_ptr<Ast> get_shared_ptr() override {
26445  return std::static_pointer_cast<ExpressionStatement>(shared_from_this());
26446  }
26447 
26448  /**
26449  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26450  */
26451  std::shared_ptr<const Ast> get_shared_ptr() const override {
26452  return std::static_pointer_cast<const ExpressionStatement>(shared_from_this());
26453  }
26454 
26455  /**
26456  * \brief Return associated token for the current ast node
26457  *
26458  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
26459  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
26460  * nullptr to store in the nmodl::symtab::SymbolTable.
26461  *
26462  * \return pointer to token if exist otherwise nullptr
26463  */
26464  const ModToken* get_token() const noexcept override {
26465  return token.get();
26466  }
26467 
26468 
26469 
26470 
26471 
26472 
26473 
26474 
26475  /**
26476  * \brief Getter for member variable \ref ExpressionStatement.expression
26477  */
26478  const std::shared_ptr<Expression>& get_expression() const noexcept {
26479  return expression;
26480  }
26481 
26482 
26483 
26484  /// \}
26485 
26486  /// \name Setters
26487  /// \{
26488 
26489 
26490  /**
26491  * \brief Set token for the current ast node
26492  */
26493  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
26494 
26495 
26496 
26497 
26498  /**
26499  * \brief Setter for member variable \ref ExpressionStatement.expression (rvalue reference)
26500  */
26501  void set_expression(std::shared_ptr<Expression>&& expression);
26502 
26503  /**
26504  * \brief Setter for member variable \ref ExpressionStatement.expression
26505  */
26506  void set_expression(const std::shared_ptr<Expression>& expression);
26507 
26508 
26509  /// \}
26510 
26511  /// \name Visitor
26512  /// \{
26513 
26514  /**
26515  * \brief visit children i.e. member variables of current node using provided visitor
26516  *
26517  * Different nodes in the AST have different members (i.e. children). This method
26518  * recursively visits children using provided visitor.
26519  *
26520  * \param v Concrete visitor that will be used to recursively visit children
26521  *
26522  * \sa Ast::visit_children for example.
26523  */
26524  void visit_children(visitor::Visitor& v) override;
26525 
26526  /**
26527  * \brief visit children i.e. member variables of current node using provided visitor
26528  *
26529  * Different nodes in the AST have different members (i.e. children). This method
26530  * recursively visits children using provided visitor.
26531  *
26532  * \param v Concrete constant visitor that will be used to recursively visit children
26533  *
26534  * \sa Ast::visit_children for example.
26535  */
26536  void visit_children(visitor::ConstVisitor& v) const override;
26537 
26538  /**
26539  * \brief accept (or visit) the current AST node using provided visitor
26540  *
26541  * Instead of visiting children of AST node, like Ast::visit_children,
26542  * accept allows to visit the current node itself using provided concrete
26543  * visitor.
26544  *
26545  * \param v Concrete visitor that will be used to recursively visit node
26546  *
26547  * \sa Ast::accept for example.
26548  */
26549  void accept(visitor::Visitor& v) override;
26550 
26551  /**
26552  * \copydoc accept(visitor::Visitor&)
26553  */
26554  void accept(visitor::ConstVisitor& v) const override;
26555 
26556  /// \}
26557 
26558 
26559 
26560  private:
26561  /**
26562  * \brief Set this object as parent for all the children
26563  *
26564  * This should be called in every object (with children) constructor
26565  * to set parents. Since it is called only in the constructors it
26566  * should not be virtual to avoid ambiguities (issue #295).
26567  */
26568  void set_parent_in_children();
26569 };
26570 
26571 /** @} */ // end of ast_class
26572 
26573 
26574 } // namespace ast
26575 } // namespace nmodl
26576 #endif // !NMODL_AST_EXPRESSION_STATEMENT_HPP
26577 #ifndef NMODL_AST_PROTECT_STATEMENT_HPP
26578 #define NMODL_AST_PROTECT_STATEMENT_HPP
26579 
26580 
26581 namespace nmodl {
26582 namespace ast {
26583 
26584 /**
26585  * @addtogroup ast_class
26586  * @ingroup ast
26587  * @{
26588  */
26589 
26590 /**
26591  * \brief TODO
26592  *
26593  *
26594 */
26595 class ProtectStatement : public Statement {
26596  private:
26597  /// TODO
26598  std::shared_ptr<Expression> expression;
26599  /// token with location information
26600  std::shared_ptr<ModToken> token;
26601 
26602  public:
26603 
26604  /// \name Ctor & dtor
26605  /// \{
26606 
26607  explicit ProtectStatement(Expression* expression);
26608  explicit ProtectStatement(const std::shared_ptr<Expression>& expression);
26609  ProtectStatement(const ProtectStatement& obj);
26610 
26611 
26612  virtual ~ProtectStatement() = default;
26613 
26614  /// \}
26615 
26616 
26617 
26618 
26619 
26620 
26621  /**
26622  * \brief Check if the ast node is an instance of ast::ProtectStatement
26623  * \return true as object is of type ast::ProtectStatement
26624  */
26625  bool is_protect_statement () const noexcept override {
26626  return true;
26627  }
26628 
26629  /**
26630  * \brief Return a copy of the current node
26631  *
26632  * Recursively make a new copy/clone of the current node including
26633  * all members and return a pointer to the node. This is used for
26634  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26635  * ast.
26636  *
26637  * @return pointer to the clone/copy of the current node
26638  */
26639  ProtectStatement* clone() const override {
26640  return new ProtectStatement(*this);
26641  }
26642 
26643  /// \name Getters
26644  /// \{
26645 
26646  /**
26647  * \brief Return type (ast::AstNodeType) of ast node
26648  *
26649  * Every node in the ast has a type defined in ast::AstNodeType and this
26650  * function is used to retrieve the same.
26651  *
26652  * \return ast node type i.e. ast::AstNodeType::PROTECT_STATEMENT
26653  *
26654  * \sa Ast::get_node_type_name
26655  */
26656  AstNodeType get_node_type() const noexcept override {
26658  }
26659 
26660  /**
26661  * \brief Return type (ast::AstNodeType) of ast node as std::string
26662  *
26663  * Every node in the ast has a type defined in ast::AstNodeType.
26664  * This type name can be returned as a std::string for printing
26665  * node to text/json form.
26666  *
26667  * \return name of the node type as a string i.e. "ProtectStatement"
26668  *
26669  * \sa Ast::get_node_name
26670  */
26671  std::string get_node_type_name() const noexcept override {
26672  return "ProtectStatement";
26673  }
26674 
26675  /**
26676  * \brief Return NMODL statement of ast node as std::string
26677  *
26678  * Every node is related to a special statement in the NMODL. This
26679  * statement can be returned as a std::string for printing to
26680  * text/json form.
26681  *
26682  * \return name of the statement as a string i.e. "PROTECT "
26683  *
26684  * \sa Ast::get_nmodl_name
26685  */
26686  std::string get_nmodl_name() const noexcept override {
26687  return "PROTECT ";
26688  }
26689 
26690  /**
26691  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26692  */
26693  std::shared_ptr<Ast> get_shared_ptr() override {
26694  return std::static_pointer_cast<ProtectStatement>(shared_from_this());
26695  }
26696 
26697  /**
26698  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26699  */
26700  std::shared_ptr<const Ast> get_shared_ptr() const override {
26701  return std::static_pointer_cast<const ProtectStatement>(shared_from_this());
26702  }
26703 
26704  /**
26705  * \brief Return associated token for the current ast node
26706  *
26707  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
26708  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
26709  * nullptr to store in the nmodl::symtab::SymbolTable.
26710  *
26711  * \return pointer to token if exist otherwise nullptr
26712  */
26713  const ModToken* get_token() const noexcept override {
26714  return token.get();
26715  }
26716 
26717 
26718 
26719 
26720 
26721 
26722 
26723 
26724  /**
26725  * \brief Getter for member variable \ref ProtectStatement.expression
26726  */
26727  const std::shared_ptr<Expression>& get_expression() const noexcept {
26728  return expression;
26729  }
26730 
26731 
26732 
26733  /// \}
26734 
26735  /// \name Setters
26736  /// \{
26737 
26738 
26739  /**
26740  * \brief Set token for the current ast node
26741  */
26742  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
26743 
26744 
26745 
26746 
26747  /**
26748  * \brief Setter for member variable \ref ProtectStatement.expression (rvalue reference)
26749  */
26750  void set_expression(std::shared_ptr<Expression>&& expression);
26751 
26752  /**
26753  * \brief Setter for member variable \ref ProtectStatement.expression
26754  */
26755  void set_expression(const std::shared_ptr<Expression>& expression);
26756 
26757 
26758  /// \}
26759 
26760  /// \name Visitor
26761  /// \{
26762 
26763  /**
26764  * \brief visit children i.e. member variables of current node using provided visitor
26765  *
26766  * Different nodes in the AST have different members (i.e. children). This method
26767  * recursively visits children using provided visitor.
26768  *
26769  * \param v Concrete visitor that will be used to recursively visit children
26770  *
26771  * \sa Ast::visit_children for example.
26772  */
26773  void visit_children(visitor::Visitor& v) override;
26774 
26775  /**
26776  * \brief visit children i.e. member variables of current node using provided visitor
26777  *
26778  * Different nodes in the AST have different members (i.e. children). This method
26779  * recursively visits children using provided visitor.
26780  *
26781  * \param v Concrete constant visitor that will be used to recursively visit children
26782  *
26783  * \sa Ast::visit_children for example.
26784  */
26785  void visit_children(visitor::ConstVisitor& v) const override;
26786 
26787  /**
26788  * \brief accept (or visit) the current AST node using provided visitor
26789  *
26790  * Instead of visiting children of AST node, like Ast::visit_children,
26791  * accept allows to visit the current node itself using provided concrete
26792  * visitor.
26793  *
26794  * \param v Concrete visitor that will be used to recursively visit node
26795  *
26796  * \sa Ast::accept for example.
26797  */
26798  void accept(visitor::Visitor& v) override;
26799 
26800  /**
26801  * \copydoc accept(visitor::Visitor&)
26802  */
26803  void accept(visitor::ConstVisitor& v) const override;
26804 
26805  /// \}
26806 
26807 
26808 
26809  private:
26810  /**
26811  * \brief Set this object as parent for all the children
26812  *
26813  * This should be called in every object (with children) constructor
26814  * to set parents. Since it is called only in the constructors it
26815  * should not be virtual to avoid ambiguities (issue #295).
26816  */
26817  void set_parent_in_children();
26818 };
26819 
26820 /** @} */ // end of ast_class
26821 
26822 
26823 } // namespace ast
26824 } // namespace nmodl
26825 #endif // !NMODL_AST_PROTECT_STATEMENT_HPP
26826 #ifndef NMODL_AST_FROM_STATEMENT_HPP
26827 #define NMODL_AST_FROM_STATEMENT_HPP
26828 
26829 
26830 namespace nmodl {
26831 namespace ast {
26832 
26833 /**
26834  * @addtogroup ast_class
26835  * @ingroup ast
26836  * @{
26837  */
26838 
26839 /**
26840  * \brief TODO
26841  *
26842  *
26843 */
26844 class FromStatement : public Statement {
26845  private:
26846  /// TODO
26847  std::shared_ptr<Name> name;
26848  /// TODO
26849  std::shared_ptr<Expression> from;
26850  /// TODO
26851  std::shared_ptr<Expression> to;
26852  /// TODO
26853  std::shared_ptr<Expression> increment;
26854  /// TODO
26855  std::shared_ptr<StatementBlock> statement_block;
26856  /// token with location information
26857  std::shared_ptr<ModToken> token;
26858 
26859  public:
26860 
26861  /// \name Ctor & dtor
26862  /// \{
26863 
26864  explicit FromStatement(Name* name, Expression* from, Expression* to, Expression* increment, StatementBlock* statement_block);
26865  explicit FromStatement(const std::shared_ptr<Name>& name, const std::shared_ptr<Expression>& from, const std::shared_ptr<Expression>& to, const std::shared_ptr<Expression>& increment, const std::shared_ptr<StatementBlock>& statement_block);
26866  FromStatement(const FromStatement& obj);
26867 
26868 
26869  virtual ~FromStatement() = default;
26870 
26871  /// \}
26872 
26873 
26874 
26875 
26876 
26877 
26878  /**
26879  * \brief Check if the ast node is an instance of ast::FromStatement
26880  * \return true as object is of type ast::FromStatement
26881  */
26882  bool is_from_statement () const noexcept override {
26883  return true;
26884  }
26885 
26886  /**
26887  * \brief Return a copy of the current node
26888  *
26889  * Recursively make a new copy/clone of the current node including
26890  * all members and return a pointer to the node. This is used for
26891  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26892  * ast.
26893  *
26894  * @return pointer to the clone/copy of the current node
26895  */
26896  FromStatement* clone() const override {
26897  return new FromStatement(*this);
26898  }
26899 
26900  /// \name Getters
26901  /// \{
26902 
26903  /**
26904  * \brief Return type (ast::AstNodeType) of ast node
26905  *
26906  * Every node in the ast has a type defined in ast::AstNodeType and this
26907  * function is used to retrieve the same.
26908  *
26909  * \return ast node type i.e. ast::AstNodeType::FROM_STATEMENT
26910  *
26911  * \sa Ast::get_node_type_name
26912  */
26913  AstNodeType get_node_type() const noexcept override {
26915  }
26916 
26917  /**
26918  * \brief Return type (ast::AstNodeType) of ast node as std::string
26919  *
26920  * Every node in the ast has a type defined in ast::AstNodeType.
26921  * This type name can be returned as a std::string for printing
26922  * node to text/json form.
26923  *
26924  * \return name of the node type as a string i.e. "FromStatement"
26925  *
26926  * \sa Ast::get_node_name
26927  */
26928  std::string get_node_type_name() const noexcept override {
26929  return "FromStatement";
26930  }
26931 
26932  /**
26933  * \brief Return NMODL statement of ast node as std::string
26934  *
26935  * Every node is related to a special statement in the NMODL. This
26936  * statement can be returned as a std::string for printing to
26937  * text/json form.
26938  *
26939  * \return name of the statement as a string i.e. "FROM "
26940  *
26941  * \sa Ast::get_nmodl_name
26942  */
26943  std::string get_nmodl_name() const noexcept override {
26944  return "FROM ";
26945  }
26946 
26947  /**
26948  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26949  */
26950  std::shared_ptr<Ast> get_shared_ptr() override {
26951  return std::static_pointer_cast<FromStatement>(shared_from_this());
26952  }
26953 
26954  /**
26955  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26956  */
26957  std::shared_ptr<const Ast> get_shared_ptr() const override {
26958  return std::static_pointer_cast<const FromStatement>(shared_from_this());
26959  }
26960 
26961  /**
26962  * \brief Return associated token for the current ast node
26963  *
26964  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
26965  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
26966  * nullptr to store in the nmodl::symtab::SymbolTable.
26967  *
26968  * \return pointer to token if exist otherwise nullptr
26969  */
26970  const ModToken* get_token() const noexcept override {
26971  return token.get();
26972  }
26973 
26974 
26975 
26976 
26977 
26978 
26979 /**
26980  * \brief Return name of the node
26981  *
26982  * Some ast nodes have a member marked designated as node name. For example,
26983  * in case of this ast::Name has name designated as a
26984  * node name.
26985  *
26986  * @return name of the node as std::string
26987  *
26988  * \sa Ast::get_node_type_name
26989  */
26990 std::string get_node_name() const override;
26991 
26992 
26993  /**
26994  * \brief Getter for member variable \ref FromStatement.name
26995  */
26996  const std::shared_ptr<Name>& get_name() const noexcept {
26997  return name;
26998  }
26999 
27000 
27001 
27002 
27003 
27004 
27005 
27006  /**
27007  * \brief Getter for member variable \ref FromStatement.from
27008  */
27009  const std::shared_ptr<Expression>& get_from() const noexcept {
27010  return from;
27011  }
27012 
27013 
27014 
27015 
27016 
27017 
27018 
27019  /**
27020  * \brief Getter for member variable \ref FromStatement.to
27021  */
27022  const std::shared_ptr<Expression>& get_to() const noexcept {
27023  return to;
27024  }
27025 
27026 
27027 
27028 
27029 
27030 
27031 
27032  /**
27033  * \brief Getter for member variable \ref FromStatement.increment
27034  */
27035  const std::shared_ptr<Expression>& get_increment() const noexcept {
27036  return increment;
27037  }
27038 
27039 
27040 
27041 
27042 
27043 
27044 
27045  /**
27046  * \brief Getter for member variable \ref FromStatement.statement_block
27047  */
27048  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
27049  return statement_block;
27050  }
27051 
27052 
27053 
27054  /// \}
27055 
27056  /// \name Setters
27057  /// \{
27058 
27059 
27060  /**
27061  * \brief Set token for the current ast node
27062  */
27063  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
27064 
27065 
27066 
27067 
27068  /**
27069  * \brief Setter for member variable \ref FromStatement.name (rvalue reference)
27070  */
27071  void set_name(std::shared_ptr<Name>&& name);
27072 
27073  /**
27074  * \brief Setter for member variable \ref FromStatement.name
27075  */
27076  void set_name(const std::shared_ptr<Name>& name);
27077 
27078 
27079  /**
27080  * \brief Setter for member variable \ref FromStatement.from (rvalue reference)
27081  */
27082  void set_from(std::shared_ptr<Expression>&& from);
27083 
27084  /**
27085  * \brief Setter for member variable \ref FromStatement.from
27086  */
27087  void set_from(const std::shared_ptr<Expression>& from);
27088 
27089 
27090  /**
27091  * \brief Setter for member variable \ref FromStatement.to (rvalue reference)
27092  */
27093  void set_to(std::shared_ptr<Expression>&& to);
27094 
27095  /**
27096  * \brief Setter for member variable \ref FromStatement.to
27097  */
27098  void set_to(const std::shared_ptr<Expression>& to);
27099 
27100 
27101  /**
27102  * \brief Setter for member variable \ref FromStatement.increment (rvalue reference)
27103  */
27104  void set_increment(std::shared_ptr<Expression>&& increment);
27105 
27106  /**
27107  * \brief Setter for member variable \ref FromStatement.increment
27108  */
27109  void set_increment(const std::shared_ptr<Expression>& increment);
27110 
27111 
27112  /**
27113  * \brief Setter for member variable \ref FromStatement.statement_block (rvalue reference)
27114  */
27115  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
27116 
27117  /**
27118  * \brief Setter for member variable \ref FromStatement.statement_block
27119  */
27120  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
27121 
27122 
27123  /// \}
27124 
27125  /// \name Visitor
27126  /// \{
27127 
27128  /**
27129  * \brief visit children i.e. member variables of current node using provided visitor
27130  *
27131  * Different nodes in the AST have different members (i.e. children). This method
27132  * recursively visits children using provided visitor.
27133  *
27134  * \param v Concrete visitor that will be used to recursively visit children
27135  *
27136  * \sa Ast::visit_children for example.
27137  */
27138  void visit_children(visitor::Visitor& v) override;
27139 
27140  /**
27141  * \brief visit children i.e. member variables of current node using provided visitor
27142  *
27143  * Different nodes in the AST have different members (i.e. children). This method
27144  * recursively visits children using provided visitor.
27145  *
27146  * \param v Concrete constant visitor that will be used to recursively visit children
27147  *
27148  * \sa Ast::visit_children for example.
27149  */
27150  void visit_children(visitor::ConstVisitor& v) const override;
27151 
27152  /**
27153  * \brief accept (or visit) the current AST node using provided visitor
27154  *
27155  * Instead of visiting children of AST node, like Ast::visit_children,
27156  * accept allows to visit the current node itself using provided concrete
27157  * visitor.
27158  *
27159  * \param v Concrete visitor that will be used to recursively visit node
27160  *
27161  * \sa Ast::accept for example.
27162  */
27163  void accept(visitor::Visitor& v) override;
27164 
27165  /**
27166  * \copydoc accept(visitor::Visitor&)
27167  */
27168  void accept(visitor::ConstVisitor& v) const override;
27169 
27170  /// \}
27171 
27172 
27173 
27174  private:
27175  /**
27176  * \brief Set this object as parent for all the children
27177  *
27178  * This should be called in every object (with children) constructor
27179  * to set parents. Since it is called only in the constructors it
27180  * should not be virtual to avoid ambiguities (issue #295).
27181  */
27182  void set_parent_in_children();
27183 };
27184 
27185 /** @} */ // end of ast_class
27186 
27187 
27188 } // namespace ast
27189 } // namespace nmodl
27190 #endif // !NMODL_AST_FROM_STATEMENT_HPP
27191 #ifndef NMODL_AST_FOR_ALL_STATEMENT_HPP
27192 #define NMODL_AST_FOR_ALL_STATEMENT_HPP
27193 
27194 
27195 namespace nmodl {
27196 namespace ast {
27197 
27198 /**
27199  * @addtogroup ast_class
27200  * @ingroup ast
27201  * @{
27202  */
27203 
27204 /**
27205  * \brief TODO
27206  *
27207  *
27208 */
27209 class ForAllStatement : public Statement {
27210  private:
27211  /// TODO
27212  std::shared_ptr<Name> name;
27213  /// TODO
27214  std::shared_ptr<StatementBlock> statement_block;
27215  /// token with location information
27216  std::shared_ptr<ModToken> token;
27217 
27218  public:
27219 
27220  /// \name Ctor & dtor
27221  /// \{
27222 
27223  explicit ForAllStatement(Name* name, StatementBlock* statement_block);
27224  explicit ForAllStatement(const std::shared_ptr<Name>& name, const std::shared_ptr<StatementBlock>& statement_block);
27225  ForAllStatement(const ForAllStatement& obj);
27226 
27227 
27228  virtual ~ForAllStatement() = default;
27229 
27230  /// \}
27231 
27232 
27233 
27234 
27235 
27236 
27237  /**
27238  * \brief Check if the ast node is an instance of ast::ForAllStatement
27239  * \return true as object is of type ast::ForAllStatement
27240  */
27241  bool is_for_all_statement () const noexcept override {
27242  return true;
27243  }
27244 
27245  /**
27246  * \brief Return a copy of the current node
27247  *
27248  * Recursively make a new copy/clone of the current node including
27249  * all members and return a pointer to the node. This is used for
27250  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27251  * ast.
27252  *
27253  * @return pointer to the clone/copy of the current node
27254  */
27255  ForAllStatement* clone() const override {
27256  return new ForAllStatement(*this);
27257  }
27258 
27259  /// \name Getters
27260  /// \{
27261 
27262  /**
27263  * \brief Return type (ast::AstNodeType) of ast node
27264  *
27265  * Every node in the ast has a type defined in ast::AstNodeType and this
27266  * function is used to retrieve the same.
27267  *
27268  * \return ast node type i.e. ast::AstNodeType::FOR_ALL_STATEMENT
27269  *
27270  * \sa Ast::get_node_type_name
27271  */
27272  AstNodeType get_node_type() const noexcept override {
27274  }
27275 
27276  /**
27277  * \brief Return type (ast::AstNodeType) of ast node as std::string
27278  *
27279  * Every node in the ast has a type defined in ast::AstNodeType.
27280  * This type name can be returned as a std::string for printing
27281  * node to text/json form.
27282  *
27283  * \return name of the node type as a string i.e. "ForAllStatement"
27284  *
27285  * \sa Ast::get_node_name
27286  */
27287  std::string get_node_type_name() const noexcept override {
27288  return "ForAllStatement";
27289  }
27290 
27291  /**
27292  * \brief Return NMODL statement of ast node as std::string
27293  *
27294  * Every node is related to a special statement in the NMODL. This
27295  * statement can be returned as a std::string for printing to
27296  * text/json form.
27297  *
27298  * \return name of the statement as a string i.e. "FORALL "
27299  *
27300  * \sa Ast::get_nmodl_name
27301  */
27302  std::string get_nmodl_name() const noexcept override {
27303  return "FORALL ";
27304  }
27305 
27306  /**
27307  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27308  */
27309  std::shared_ptr<Ast> get_shared_ptr() override {
27310  return std::static_pointer_cast<ForAllStatement>(shared_from_this());
27311  }
27312 
27313  /**
27314  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27315  */
27316  std::shared_ptr<const Ast> get_shared_ptr() const override {
27317  return std::static_pointer_cast<const ForAllStatement>(shared_from_this());
27318  }
27319 
27320  /**
27321  * \brief Return associated token for the current ast node
27322  *
27323  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
27324  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
27325  * nullptr to store in the nmodl::symtab::SymbolTable.
27326  *
27327  * \return pointer to token if exist otherwise nullptr
27328  */
27329  const ModToken* get_token() const noexcept override {
27330  return token.get();
27331  }
27332 
27333 
27334 
27335 
27336 
27337 
27338 
27339 
27340  /**
27341  * \brief Getter for member variable \ref ForAllStatement.name
27342  */
27343  const std::shared_ptr<Name>& get_name() const noexcept {
27344  return name;
27345  }
27346 
27347 
27348 
27349 
27350 
27351 
27352 
27353  /**
27354  * \brief Getter for member variable \ref ForAllStatement.statement_block
27355  */
27356  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
27357  return statement_block;
27358  }
27359 
27360 
27361 
27362  /// \}
27363 
27364  /// \name Setters
27365  /// \{
27366 
27367 
27368  /**
27369  * \brief Set token for the current ast node
27370  */
27371  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
27372 
27373 
27374 
27375 
27376  /**
27377  * \brief Setter for member variable \ref ForAllStatement.name (rvalue reference)
27378  */
27379  void set_name(std::shared_ptr<Name>&& name);
27380 
27381  /**
27382  * \brief Setter for member variable \ref ForAllStatement.name
27383  */
27384  void set_name(const std::shared_ptr<Name>& name);
27385 
27386 
27387  /**
27388  * \brief Setter for member variable \ref ForAllStatement.statement_block (rvalue reference)
27389  */
27390  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
27391 
27392  /**
27393  * \brief Setter for member variable \ref ForAllStatement.statement_block
27394  */
27395  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
27396 
27397 
27398  /// \}
27399 
27400  /// \name Visitor
27401  /// \{
27402 
27403  /**
27404  * \brief visit children i.e. member variables of current node using provided visitor
27405  *
27406  * Different nodes in the AST have different members (i.e. children). This method
27407  * recursively visits children using provided visitor.
27408  *
27409  * \param v Concrete visitor that will be used to recursively visit children
27410  *
27411  * \sa Ast::visit_children for example.
27412  */
27413  void visit_children(visitor::Visitor& v) override;
27414 
27415  /**
27416  * \brief visit children i.e. member variables of current node using provided visitor
27417  *
27418  * Different nodes in the AST have different members (i.e. children). This method
27419  * recursively visits children using provided visitor.
27420  *
27421  * \param v Concrete constant visitor that will be used to recursively visit children
27422  *
27423  * \sa Ast::visit_children for example.
27424  */
27425  void visit_children(visitor::ConstVisitor& v) const override;
27426 
27427  /**
27428  * \brief accept (or visit) the current AST node using provided visitor
27429  *
27430  * Instead of visiting children of AST node, like Ast::visit_children,
27431  * accept allows to visit the current node itself using provided concrete
27432  * visitor.
27433  *
27434  * \param v Concrete visitor that will be used to recursively visit node
27435  *
27436  * \sa Ast::accept for example.
27437  */
27438  void accept(visitor::Visitor& v) override;
27439 
27440  /**
27441  * \copydoc accept(visitor::Visitor&)
27442  */
27443  void accept(visitor::ConstVisitor& v) const override;
27444 
27445  /// \}
27446 
27447 
27448 
27449  private:
27450  /**
27451  * \brief Set this object as parent for all the children
27452  *
27453  * This should be called in every object (with children) constructor
27454  * to set parents. Since it is called only in the constructors it
27455  * should not be virtual to avoid ambiguities (issue #295).
27456  */
27457  void set_parent_in_children();
27458 };
27459 
27460 /** @} */ // end of ast_class
27461 
27462 
27463 } // namespace ast
27464 } // namespace nmodl
27465 #endif // !NMODL_AST_FOR_ALL_STATEMENT_HPP
27466 #ifndef NMODL_AST_WHILE_STATEMENT_HPP
27467 #define NMODL_AST_WHILE_STATEMENT_HPP
27468 
27469 
27470 namespace nmodl {
27471 namespace ast {
27472 
27473 /**
27474  * @addtogroup ast_class
27475  * @ingroup ast
27476  * @{
27477  */
27478 
27479 /**
27480  * \brief TODO
27481  *
27482  *
27483 */
27484 class WhileStatement : public Statement {
27485  private:
27486  /// TODO
27487  std::shared_ptr<Expression> condition;
27488  /// TODO
27489  std::shared_ptr<StatementBlock> statement_block;
27490  /// token with location information
27491  std::shared_ptr<ModToken> token;
27492 
27493  public:
27494 
27495  /// \name Ctor & dtor
27496  /// \{
27497 
27498  explicit WhileStatement(Expression* condition, StatementBlock* statement_block);
27499  explicit WhileStatement(const std::shared_ptr<Expression>& condition, const std::shared_ptr<StatementBlock>& statement_block);
27500  WhileStatement(const WhileStatement& obj);
27501 
27502 
27503  virtual ~WhileStatement() = default;
27504 
27505  /// \}
27506 
27507 
27508 
27509 
27510 
27511 
27512  /**
27513  * \brief Check if the ast node is an instance of ast::WhileStatement
27514  * \return true as object is of type ast::WhileStatement
27515  */
27516  bool is_while_statement () const noexcept override {
27517  return true;
27518  }
27519 
27520  /**
27521  * \brief Return a copy of the current node
27522  *
27523  * Recursively make a new copy/clone of the current node including
27524  * all members and return a pointer to the node. This is used for
27525  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27526  * ast.
27527  *
27528  * @return pointer to the clone/copy of the current node
27529  */
27530  WhileStatement* clone() const override {
27531  return new WhileStatement(*this);
27532  }
27533 
27534  /// \name Getters
27535  /// \{
27536 
27537  /**
27538  * \brief Return type (ast::AstNodeType) of ast node
27539  *
27540  * Every node in the ast has a type defined in ast::AstNodeType and this
27541  * function is used to retrieve the same.
27542  *
27543  * \return ast node type i.e. ast::AstNodeType::WHILE_STATEMENT
27544  *
27545  * \sa Ast::get_node_type_name
27546  */
27547  AstNodeType get_node_type() const noexcept override {
27549  }
27550 
27551  /**
27552  * \brief Return type (ast::AstNodeType) of ast node as std::string
27553  *
27554  * Every node in the ast has a type defined in ast::AstNodeType.
27555  * This type name can be returned as a std::string for printing
27556  * node to text/json form.
27557  *
27558  * \return name of the node type as a string i.e. "WhileStatement"
27559  *
27560  * \sa Ast::get_node_name
27561  */
27562  std::string get_node_type_name() const noexcept override {
27563  return "WhileStatement";
27564  }
27565 
27566  /**
27567  * \brief Return NMODL statement of ast node as std::string
27568  *
27569  * Every node is related to a special statement in the NMODL. This
27570  * statement can be returned as a std::string for printing to
27571  * text/json form.
27572  *
27573  * \return name of the statement as a string i.e. "WHILE "
27574  *
27575  * \sa Ast::get_nmodl_name
27576  */
27577  std::string get_nmodl_name() const noexcept override {
27578  return "WHILE ";
27579  }
27580 
27581  /**
27582  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27583  */
27584  std::shared_ptr<Ast> get_shared_ptr() override {
27585  return std::static_pointer_cast<WhileStatement>(shared_from_this());
27586  }
27587 
27588  /**
27589  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27590  */
27591  std::shared_ptr<const Ast> get_shared_ptr() const override {
27592  return std::static_pointer_cast<const WhileStatement>(shared_from_this());
27593  }
27594 
27595  /**
27596  * \brief Return associated token for the current ast node
27597  *
27598  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
27599  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
27600  * nullptr to store in the nmodl::symtab::SymbolTable.
27601  *
27602  * \return pointer to token if exist otherwise nullptr
27603  */
27604  const ModToken* get_token() const noexcept override {
27605  return token.get();
27606  }
27607 
27608 
27609 
27610 
27611 
27612 
27613 
27614 
27615  /**
27616  * \brief Getter for member variable \ref WhileStatement.condition
27617  */
27618  const std::shared_ptr<Expression>& get_condition() const noexcept {
27619  return condition;
27620  }
27621 
27622 
27623 
27624 
27625 
27626 
27627 
27628  /**
27629  * \brief Getter for member variable \ref WhileStatement.statement_block
27630  */
27631  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
27632  return statement_block;
27633  }
27634 
27635 
27636 
27637  /// \}
27638 
27639  /// \name Setters
27640  /// \{
27641 
27642 
27643  /**
27644  * \brief Set token for the current ast node
27645  */
27646  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
27647 
27648 
27649 
27650 
27651  /**
27652  * \brief Setter for member variable \ref WhileStatement.condition (rvalue reference)
27653  */
27654  void set_condition(std::shared_ptr<Expression>&& condition);
27655 
27656  /**
27657  * \brief Setter for member variable \ref WhileStatement.condition
27658  */
27659  void set_condition(const std::shared_ptr<Expression>& condition);
27660 
27661 
27662  /**
27663  * \brief Setter for member variable \ref WhileStatement.statement_block (rvalue reference)
27664  */
27665  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
27666 
27667  /**
27668  * \brief Setter for member variable \ref WhileStatement.statement_block
27669  */
27670  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
27671 
27672 
27673  /// \}
27674 
27675  /// \name Visitor
27676  /// \{
27677 
27678  /**
27679  * \brief visit children i.e. member variables of current node using provided visitor
27680  *
27681  * Different nodes in the AST have different members (i.e. children). This method
27682  * recursively visits children using provided visitor.
27683  *
27684  * \param v Concrete visitor that will be used to recursively visit children
27685  *
27686  * \sa Ast::visit_children for example.
27687  */
27688  void visit_children(visitor::Visitor& v) override;
27689 
27690  /**
27691  * \brief visit children i.e. member variables of current node using provided visitor
27692  *
27693  * Different nodes in the AST have different members (i.e. children). This method
27694  * recursively visits children using provided visitor.
27695  *
27696  * \param v Concrete constant visitor that will be used to recursively visit children
27697  *
27698  * \sa Ast::visit_children for example.
27699  */
27700  void visit_children(visitor::ConstVisitor& v) const override;
27701 
27702  /**
27703  * \brief accept (or visit) the current AST node using provided visitor
27704  *
27705  * Instead of visiting children of AST node, like Ast::visit_children,
27706  * accept allows to visit the current node itself using provided concrete
27707  * visitor.
27708  *
27709  * \param v Concrete visitor that will be used to recursively visit node
27710  *
27711  * \sa Ast::accept for example.
27712  */
27713  void accept(visitor::Visitor& v) override;
27714 
27715  /**
27716  * \copydoc accept(visitor::Visitor&)
27717  */
27718  void accept(visitor::ConstVisitor& v) const override;
27719 
27720  /// \}
27721 
27722 
27723 
27724  private:
27725  /**
27726  * \brief Set this object as parent for all the children
27727  *
27728  * This should be called in every object (with children) constructor
27729  * to set parents. Since it is called only in the constructors it
27730  * should not be virtual to avoid ambiguities (issue #295).
27731  */
27732  void set_parent_in_children();
27733 };
27734 
27735 /** @} */ // end of ast_class
27736 
27737 
27738 } // namespace ast
27739 } // namespace nmodl
27740 #endif // !NMODL_AST_WHILE_STATEMENT_HPP
27741 #ifndef NMODL_AST_IF_STATEMENT_HPP
27742 #define NMODL_AST_IF_STATEMENT_HPP
27743 
27744 
27745 namespace nmodl {
27746 namespace ast {
27747 
27748 /**
27749  * @addtogroup ast_class
27750  * @ingroup ast
27751  * @{
27752  */
27753 
27754 /**
27755  * \brief TODO
27756  *
27757  *
27758 */
27759 class IfStatement : public Statement {
27760  private:
27761  /// TODO
27762  std::shared_ptr<Expression> condition;
27763  /// TODO
27764  std::shared_ptr<StatementBlock> statement_block;
27765  /// TODO
27767  /// TODO
27768  std::shared_ptr<ElseStatement> elses;
27769  /// token with location information
27770  std::shared_ptr<ModToken> token;
27771 
27772  public:
27773 
27774  /// \name Ctor & dtor
27775  /// \{
27776 
27777  explicit IfStatement(Expression* condition, StatementBlock* statement_block, ElseIfStatementVector elseifs, ElseStatement* elses);
27778  explicit IfStatement(const std::shared_ptr<Expression>& condition, const std::shared_ptr<StatementBlock>& statement_block, const ElseIfStatementVector& elseifs, const std::shared_ptr<ElseStatement>& elses);
27779  IfStatement(const IfStatement& obj);
27780 
27781 
27782  virtual ~IfStatement() = default;
27783 
27784  /// \}
27785 
27786 
27787 
27788 
27789 
27790 
27791  /**
27792  * \brief Check if the ast node is an instance of ast::IfStatement
27793  * \return true as object is of type ast::IfStatement
27794  */
27795  bool is_if_statement () const noexcept override {
27796  return true;
27797  }
27798 
27799  /**
27800  * \brief Return a copy of the current node
27801  *
27802  * Recursively make a new copy/clone of the current node including
27803  * all members and return a pointer to the node. This is used for
27804  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27805  * ast.
27806  *
27807  * @return pointer to the clone/copy of the current node
27808  */
27809  IfStatement* clone() const override {
27810  return new IfStatement(*this);
27811  }
27812 
27813  /// \name Getters
27814  /// \{
27815 
27816  /**
27817  * \brief Return type (ast::AstNodeType) of ast node
27818  *
27819  * Every node in the ast has a type defined in ast::AstNodeType and this
27820  * function is used to retrieve the same.
27821  *
27822  * \return ast node type i.e. ast::AstNodeType::IF_STATEMENT
27823  *
27824  * \sa Ast::get_node_type_name
27825  */
27826  AstNodeType get_node_type() const noexcept override {
27828  }
27829 
27830  /**
27831  * \brief Return type (ast::AstNodeType) of ast node as std::string
27832  *
27833  * Every node in the ast has a type defined in ast::AstNodeType.
27834  * This type name can be returned as a std::string for printing
27835  * node to text/json form.
27836  *
27837  * \return name of the node type as a string i.e. "IfStatement"
27838  *
27839  * \sa Ast::get_node_name
27840  */
27841  std::string get_node_type_name() const noexcept override {
27842  return "IfStatement";
27843  }
27844 
27845  /**
27846  * \brief Return NMODL statement of ast node as std::string
27847  *
27848  * Every node is related to a special statement in the NMODL. This
27849  * statement can be returned as a std::string for printing to
27850  * text/json form.
27851  *
27852  * \return name of the statement as a string i.e. "IF "
27853  *
27854  * \sa Ast::get_nmodl_name
27855  */
27856  std::string get_nmodl_name() const noexcept override {
27857  return "IF ";
27858  }
27859 
27860  /**
27861  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27862  */
27863  std::shared_ptr<Ast> get_shared_ptr() override {
27864  return std::static_pointer_cast<IfStatement>(shared_from_this());
27865  }
27866 
27867  /**
27868  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27869  */
27870  std::shared_ptr<const Ast> get_shared_ptr() const override {
27871  return std::static_pointer_cast<const IfStatement>(shared_from_this());
27872  }
27873 
27874  /**
27875  * \brief Return associated token for the current ast node
27876  *
27877  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
27878  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
27879  * nullptr to store in the nmodl::symtab::SymbolTable.
27880  *
27881  * \return pointer to token if exist otherwise nullptr
27882  */
27883  const ModToken* get_token() const noexcept override {
27884  return token.get();
27885  }
27886 
27887 
27888 
27889 
27890 
27891 
27892 
27893 
27894  /**
27895  * \brief Getter for member variable \ref IfStatement.condition
27896  */
27897  const std::shared_ptr<Expression>& get_condition() const noexcept {
27898  return condition;
27899  }
27900 
27901 
27902 
27903 
27904 
27905 
27906 
27907  /**
27908  * \brief Getter for member variable \ref IfStatement.statement_block
27909  */
27910  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
27911  return statement_block;
27912  }
27913 
27914 
27915 
27916 
27917 
27918 
27919 
27920  /**
27921  * \brief Getter for member variable \ref IfStatement.elseifs
27922  */
27923  const ElseIfStatementVector& get_elseifs() const noexcept {
27924  return elseifs;
27925  }
27926 
27927 
27928 
27929 
27930 
27931 
27932 
27933  /**
27934  * \brief Getter for member variable \ref IfStatement.elses
27935  */
27936  const std::shared_ptr<ElseStatement>& get_elses() const noexcept {
27937  return elses;
27938  }
27939 
27940 
27941 
27942  /// \}
27943 
27944  /// \name Setters
27945  /// \{
27946 
27947 
27948  /**
27949  * \brief Set token for the current ast node
27950  */
27951  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
27952 
27953 
27954 
27955 
27956  /**
27957  * \brief Setter for member variable \ref IfStatement.condition (rvalue reference)
27958  */
27959  void set_condition(std::shared_ptr<Expression>&& condition);
27960 
27961  /**
27962  * \brief Setter for member variable \ref IfStatement.condition
27963  */
27964  void set_condition(const std::shared_ptr<Expression>& condition);
27965 
27966 
27967  /**
27968  * \brief Setter for member variable \ref IfStatement.statement_block (rvalue reference)
27969  */
27970  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
27971 
27972  /**
27973  * \brief Setter for member variable \ref IfStatement.statement_block
27974  */
27975  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
27976 
27977 
27978  /**
27979  * \brief Setter for member variable \ref IfStatement.elseifs (rvalue reference)
27980  */
27981  void set_elseifs(ElseIfStatementVector&& elseifs);
27982 
27983  /**
27984  * \brief Setter for member variable \ref IfStatement.elseifs
27985  */
27986  void set_elseifs(const ElseIfStatementVector& elseifs);
27987 
27988 
27989  /**
27990  * \brief Setter for member variable \ref IfStatement.elses (rvalue reference)
27991  */
27992  void set_elses(std::shared_ptr<ElseStatement>&& elses);
27993 
27994  /**
27995  * \brief Setter for member variable \ref IfStatement.elses
27996  */
27997  void set_elses(const std::shared_ptr<ElseStatement>& elses);
27998 
27999 
28000  /// \}
28001 
28002  /// \name Visitor
28003  /// \{
28004 
28005  /**
28006  * \brief visit children i.e. member variables of current node using provided visitor
28007  *
28008  * Different nodes in the AST have different members (i.e. children). This method
28009  * recursively visits children using provided visitor.
28010  *
28011  * \param v Concrete visitor that will be used to recursively visit children
28012  *
28013  * \sa Ast::visit_children for example.
28014  */
28015  void visit_children(visitor::Visitor& v) override;
28016 
28017  /**
28018  * \brief visit children i.e. member variables of current node using provided visitor
28019  *
28020  * Different nodes in the AST have different members (i.e. children). This method
28021  * recursively visits children using provided visitor.
28022  *
28023  * \param v Concrete constant visitor that will be used to recursively visit children
28024  *
28025  * \sa Ast::visit_children for example.
28026  */
28027  void visit_children(visitor::ConstVisitor& v) const override;
28028 
28029  /**
28030  * \brief accept (or visit) the current AST node using provided visitor
28031  *
28032  * Instead of visiting children of AST node, like Ast::visit_children,
28033  * accept allows to visit the current node itself using provided concrete
28034  * visitor.
28035  *
28036  * \param v Concrete visitor that will be used to recursively visit node
28037  *
28038  * \sa Ast::accept for example.
28039  */
28040  void accept(visitor::Visitor& v) override;
28041 
28042  /**
28043  * \copydoc accept(visitor::Visitor&)
28044  */
28045  void accept(visitor::ConstVisitor& v) const override;
28046 
28047  /// \}
28048 
28049 
28050 
28051  private:
28052  /**
28053  * \brief Set this object as parent for all the children
28054  *
28055  * This should be called in every object (with children) constructor
28056  * to set parents. Since it is called only in the constructors it
28057  * should not be virtual to avoid ambiguities (issue #295).
28058  */
28059  void set_parent_in_children();
28060 };
28061 
28062 /** @} */ // end of ast_class
28063 
28064 
28065 } // namespace ast
28066 } // namespace nmodl
28067 #endif // !NMODL_AST_IF_STATEMENT_HPP
28068 #ifndef NMODL_AST_ELSE_IF_STATEMENT_HPP
28069 #define NMODL_AST_ELSE_IF_STATEMENT_HPP
28070 
28071 
28072 namespace nmodl {
28073 namespace ast {
28074 
28075 /**
28076  * @addtogroup ast_class
28077  * @ingroup ast
28078  * @{
28079  */
28080 
28081 /**
28082  * \brief TODO
28083  *
28084  *
28085 */
28086 class ElseIfStatement : public Statement {
28087  private:
28088  /// TODO
28089  std::shared_ptr<Expression> condition;
28090  /// TODO
28091  std::shared_ptr<StatementBlock> statement_block;
28092  /// token with location information
28093  std::shared_ptr<ModToken> token;
28094 
28095  public:
28096 
28097  /// \name Ctor & dtor
28098  /// \{
28099 
28100  explicit ElseIfStatement(Expression* condition, StatementBlock* statement_block);
28101  explicit ElseIfStatement(const std::shared_ptr<Expression>& condition, const std::shared_ptr<StatementBlock>& statement_block);
28102  ElseIfStatement(const ElseIfStatement& obj);
28103 
28104 
28105  virtual ~ElseIfStatement() = default;
28106 
28107  /// \}
28108 
28109 
28110 
28111 
28112 
28113 
28114  /**
28115  * \brief Check if the ast node is an instance of ast::ElseIfStatement
28116  * \return true as object is of type ast::ElseIfStatement
28117  */
28118  bool is_else_if_statement () const noexcept override {
28119  return true;
28120  }
28121 
28122  /**
28123  * \brief Return a copy of the current node
28124  *
28125  * Recursively make a new copy/clone of the current node including
28126  * all members and return a pointer to the node. This is used for
28127  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28128  * ast.
28129  *
28130  * @return pointer to the clone/copy of the current node
28131  */
28132  ElseIfStatement* clone() const override {
28133  return new ElseIfStatement(*this);
28134  }
28135 
28136  /// \name Getters
28137  /// \{
28138 
28139  /**
28140  * \brief Return type (ast::AstNodeType) of ast node
28141  *
28142  * Every node in the ast has a type defined in ast::AstNodeType and this
28143  * function is used to retrieve the same.
28144  *
28145  * \return ast node type i.e. ast::AstNodeType::ELSE_IF_STATEMENT
28146  *
28147  * \sa Ast::get_node_type_name
28148  */
28149  AstNodeType get_node_type() const noexcept override {
28151  }
28152 
28153  /**
28154  * \brief Return type (ast::AstNodeType) of ast node as std::string
28155  *
28156  * Every node in the ast has a type defined in ast::AstNodeType.
28157  * This type name can be returned as a std::string for printing
28158  * node to text/json form.
28159  *
28160  * \return name of the node type as a string i.e. "ElseIfStatement"
28161  *
28162  * \sa Ast::get_node_name
28163  */
28164  std::string get_node_type_name() const noexcept override {
28165  return "ElseIfStatement";
28166  }
28167 
28168  /**
28169  * \brief Return NMODL statement of ast node as std::string
28170  *
28171  * Every node is related to a special statement in the NMODL. This
28172  * statement can be returned as a std::string for printing to
28173  * text/json form.
28174  *
28175  * \return name of the statement as a string i.e. " ELSE IF "
28176  *
28177  * \sa Ast::get_nmodl_name
28178  */
28179  std::string get_nmodl_name() const noexcept override {
28180  return " ELSE IF ";
28181  }
28182 
28183  /**
28184  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28185  */
28186  std::shared_ptr<Ast> get_shared_ptr() override {
28187  return std::static_pointer_cast<ElseIfStatement>(shared_from_this());
28188  }
28189 
28190  /**
28191  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28192  */
28193  std::shared_ptr<const Ast> get_shared_ptr() const override {
28194  return std::static_pointer_cast<const ElseIfStatement>(shared_from_this());
28195  }
28196 
28197  /**
28198  * \brief Return associated token for the current ast node
28199  *
28200  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
28201  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
28202  * nullptr to store in the nmodl::symtab::SymbolTable.
28203  *
28204  * \return pointer to token if exist otherwise nullptr
28205  */
28206  const ModToken* get_token() const noexcept override {
28207  return token.get();
28208  }
28209 
28210 
28211 
28212 
28213 
28214 
28215 
28216 
28217  /**
28218  * \brief Getter for member variable \ref ElseIfStatement.condition
28219  */
28220  const std::shared_ptr<Expression>& get_condition() const noexcept {
28221  return condition;
28222  }
28223 
28224 
28225 
28226 
28227 
28228 
28229 
28230  /**
28231  * \brief Getter for member variable \ref ElseIfStatement.statement_block
28232  */
28233  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
28234  return statement_block;
28235  }
28236 
28237 
28238 
28239  /// \}
28240 
28241  /// \name Setters
28242  /// \{
28243 
28244 
28245  /**
28246  * \brief Set token for the current ast node
28247  */
28248  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
28249 
28250 
28251 
28252 
28253  /**
28254  * \brief Setter for member variable \ref ElseIfStatement.condition (rvalue reference)
28255  */
28256  void set_condition(std::shared_ptr<Expression>&& condition);
28257 
28258  /**
28259  * \brief Setter for member variable \ref ElseIfStatement.condition
28260  */
28261  void set_condition(const std::shared_ptr<Expression>& condition);
28262 
28263 
28264  /**
28265  * \brief Setter for member variable \ref ElseIfStatement.statement_block (rvalue reference)
28266  */
28267  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
28268 
28269  /**
28270  * \brief Setter for member variable \ref ElseIfStatement.statement_block
28271  */
28272  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
28273 
28274 
28275  /// \}
28276 
28277  /// \name Visitor
28278  /// \{
28279 
28280  /**
28281  * \brief visit children i.e. member variables of current node using provided visitor
28282  *
28283  * Different nodes in the AST have different members (i.e. children). This method
28284  * recursively visits children using provided visitor.
28285  *
28286  * \param v Concrete visitor that will be used to recursively visit children
28287  *
28288  * \sa Ast::visit_children for example.
28289  */
28290  void visit_children(visitor::Visitor& v) override;
28291 
28292  /**
28293  * \brief visit children i.e. member variables of current node using provided visitor
28294  *
28295  * Different nodes in the AST have different members (i.e. children). This method
28296  * recursively visits children using provided visitor.
28297  *
28298  * \param v Concrete constant visitor that will be used to recursively visit children
28299  *
28300  * \sa Ast::visit_children for example.
28301  */
28302  void visit_children(visitor::ConstVisitor& v) const override;
28303 
28304  /**
28305  * \brief accept (or visit) the current AST node using provided visitor
28306  *
28307  * Instead of visiting children of AST node, like Ast::visit_children,
28308  * accept allows to visit the current node itself using provided concrete
28309  * visitor.
28310  *
28311  * \param v Concrete visitor that will be used to recursively visit node
28312  *
28313  * \sa Ast::accept for example.
28314  */
28315  void accept(visitor::Visitor& v) override;
28316 
28317  /**
28318  * \copydoc accept(visitor::Visitor&)
28319  */
28320  void accept(visitor::ConstVisitor& v) const override;
28321 
28322  /// \}
28323 
28324 
28325 
28326  private:
28327  /**
28328  * \brief Set this object as parent for all the children
28329  *
28330  * This should be called in every object (with children) constructor
28331  * to set parents. Since it is called only in the constructors it
28332  * should not be virtual to avoid ambiguities (issue #295).
28333  */
28334  void set_parent_in_children();
28335 };
28336 
28337 /** @} */ // end of ast_class
28338 
28339 
28340 } // namespace ast
28341 } // namespace nmodl
28342 #endif // !NMODL_AST_ELSE_IF_STATEMENT_HPP
28343 #ifndef NMODL_AST_ELSE_STATEMENT_HPP
28344 #define NMODL_AST_ELSE_STATEMENT_HPP
28345 
28346 
28347 namespace nmodl {
28348 namespace ast {
28349 
28350 /**
28351  * @addtogroup ast_class
28352  * @ingroup ast
28353  * @{
28354  */
28355 
28356 /**
28357  * \brief TODO
28358  *
28359  *
28360 */
28361 class ElseStatement : public Statement {
28362  private:
28363  /// TODO
28364  std::shared_ptr<StatementBlock> statement_block;
28365  /// token with location information
28366  std::shared_ptr<ModToken> token;
28367 
28368  public:
28369 
28370  /// \name Ctor & dtor
28371  /// \{
28372 
28373  explicit ElseStatement(StatementBlock* statement_block);
28374  explicit ElseStatement(const std::shared_ptr<StatementBlock>& statement_block);
28375  ElseStatement(const ElseStatement& obj);
28376 
28377 
28378  virtual ~ElseStatement() = default;
28379 
28380  /// \}
28381 
28382 
28383 
28384 
28385 
28386 
28387  /**
28388  * \brief Check if the ast node is an instance of ast::ElseStatement
28389  * \return true as object is of type ast::ElseStatement
28390  */
28391  bool is_else_statement () const noexcept override {
28392  return true;
28393  }
28394 
28395  /**
28396  * \brief Return a copy of the current node
28397  *
28398  * Recursively make a new copy/clone of the current node including
28399  * all members and return a pointer to the node. This is used for
28400  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28401  * ast.
28402  *
28403  * @return pointer to the clone/copy of the current node
28404  */
28405  ElseStatement* clone() const override {
28406  return new ElseStatement(*this);
28407  }
28408 
28409  /// \name Getters
28410  /// \{
28411 
28412  /**
28413  * \brief Return type (ast::AstNodeType) of ast node
28414  *
28415  * Every node in the ast has a type defined in ast::AstNodeType and this
28416  * function is used to retrieve the same.
28417  *
28418  * \return ast node type i.e. ast::AstNodeType::ELSE_STATEMENT
28419  *
28420  * \sa Ast::get_node_type_name
28421  */
28422  AstNodeType get_node_type() const noexcept override {
28424  }
28425 
28426  /**
28427  * \brief Return type (ast::AstNodeType) of ast node as std::string
28428  *
28429  * Every node in the ast has a type defined in ast::AstNodeType.
28430  * This type name can be returned as a std::string for printing
28431  * node to text/json form.
28432  *
28433  * \return name of the node type as a string i.e. "ElseStatement"
28434  *
28435  * \sa Ast::get_node_name
28436  */
28437  std::string get_node_type_name() const noexcept override {
28438  return "ElseStatement";
28439  }
28440 
28441  /**
28442  * \brief Return NMODL statement of ast node as std::string
28443  *
28444  * Every node is related to a special statement in the NMODL. This
28445  * statement can be returned as a std::string for printing to
28446  * text/json form.
28447  *
28448  * \return name of the statement as a string i.e. " ELSE "
28449  *
28450  * \sa Ast::get_nmodl_name
28451  */
28452  std::string get_nmodl_name() const noexcept override {
28453  return " ELSE ";
28454  }
28455 
28456  /**
28457  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28458  */
28459  std::shared_ptr<Ast> get_shared_ptr() override {
28460  return std::static_pointer_cast<ElseStatement>(shared_from_this());
28461  }
28462 
28463  /**
28464  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28465  */
28466  std::shared_ptr<const Ast> get_shared_ptr() const override {
28467  return std::static_pointer_cast<const ElseStatement>(shared_from_this());
28468  }
28469 
28470  /**
28471  * \brief Return associated token for the current ast node
28472  *
28473  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
28474  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
28475  * nullptr to store in the nmodl::symtab::SymbolTable.
28476  *
28477  * \return pointer to token if exist otherwise nullptr
28478  */
28479  const ModToken* get_token() const noexcept override {
28480  return token.get();
28481  }
28482 
28483 
28484 
28485 
28486 
28487 
28488 
28489 
28490  /**
28491  * \brief Getter for member variable \ref ElseStatement.statement_block
28492  */
28493  const std::shared_ptr<StatementBlock>& get_statement_block() const noexcept override {
28494  return statement_block;
28495  }
28496 
28497 
28498 
28499  /// \}
28500 
28501  /// \name Setters
28502  /// \{
28503 
28504 
28505  /**
28506  * \brief Set token for the current ast node
28507  */
28508  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
28509 
28510 
28511 
28512 
28513  /**
28514  * \brief Setter for member variable \ref ElseStatement.statement_block (rvalue reference)
28515  */
28516  void set_statement_block(std::shared_ptr<StatementBlock>&& statement_block);
28517 
28518  /**
28519  * \brief Setter for member variable \ref ElseStatement.statement_block
28520  */
28521  void set_statement_block(const std::shared_ptr<StatementBlock>& statement_block);
28522 
28523 
28524  /// \}
28525 
28526  /// \name Visitor
28527  /// \{
28528 
28529  /**
28530  * \brief visit children i.e. member variables of current node using provided visitor
28531  *
28532  * Different nodes in the AST have different members (i.e. children). This method
28533  * recursively visits children using provided visitor.
28534  *
28535  * \param v Concrete visitor that will be used to recursively visit children
28536  *
28537  * \sa Ast::visit_children for example.
28538  */
28539  void visit_children(visitor::Visitor& v) override;
28540 
28541  /**
28542  * \brief visit children i.e. member variables of current node using provided visitor
28543  *
28544  * Different nodes in the AST have different members (i.e. children). This method
28545  * recursively visits children using provided visitor.
28546  *
28547  * \param v Concrete constant visitor that will be used to recursively visit children
28548  *
28549  * \sa Ast::visit_children for example.
28550  */
28551  void visit_children(visitor::ConstVisitor& v) const override;
28552 
28553  /**
28554  * \brief accept (or visit) the current AST node using provided visitor
28555  *
28556  * Instead of visiting children of AST node, like Ast::visit_children,
28557  * accept allows to visit the current node itself using provided concrete
28558  * visitor.
28559  *
28560  * \param v Concrete visitor that will be used to recursively visit node
28561  *
28562  * \sa Ast::accept for example.
28563  */
28564  void accept(visitor::Visitor& v) override;
28565 
28566  /**
28567  * \copydoc accept(visitor::Visitor&)
28568  */
28569  void accept(visitor::ConstVisitor& v) const override;
28570 
28571  /// \}
28572 
28573 
28574 
28575  private:
28576  /**
28577  * \brief Set this object as parent for all the children
28578  *
28579  * This should be called in every object (with children) constructor
28580  * to set parents. Since it is called only in the constructors it
28581  * should not be virtual to avoid ambiguities (issue #295).
28582  */
28583  void set_parent_in_children();
28584 };
28585 
28586 /** @} */ // end of ast_class
28587 
28588 
28589 } // namespace ast
28590 } // namespace nmodl
28591 #endif // !NMODL_AST_ELSE_STATEMENT_HPP
28592 #ifndef NMODL_AST_PARTIAL_EQUATION_HPP
28593 #define NMODL_AST_PARTIAL_EQUATION_HPP
28594 
28595 
28596 namespace nmodl {
28597 namespace ast {
28598 
28599 /**
28600  * @addtogroup ast_class
28601  * @ingroup ast
28602  * @{
28603  */
28604 
28605 /**
28606  * \brief TODO
28607  *
28608  *
28609 */
28610 class PartialEquation : public Statement {
28611  private:
28612  /// TODO
28613  std::shared_ptr<PrimeName> prime;
28614  /// TODO
28615  std::shared_ptr<Name> name1;
28616  /// TODO
28617  std::shared_ptr<Name> name2;
28618  /// TODO
28619  std::shared_ptr<Name> name3;
28620  /// token with location information
28621  std::shared_ptr<ModToken> token;
28622 
28623  public:
28624 
28625  /// \name Ctor & dtor
28626  /// \{
28627 
28628  explicit PartialEquation(PrimeName* prime, Name* name1, Name* name2, Name* name3);
28629  explicit PartialEquation(const std::shared_ptr<PrimeName>& prime, const std::shared_ptr<Name>& name1, const std::shared_ptr<Name>& name2, const std::shared_ptr<Name>& name3);
28630  PartialEquation(const PartialEquation& obj);
28631 
28632 
28633  virtual ~PartialEquation() = default;
28634 
28635  /// \}
28636 
28637 
28638 
28639 
28640 
28641 
28642  /**
28643  * \brief Check if the ast node is an instance of ast::PartialEquation
28644  * \return true as object is of type ast::PartialEquation
28645  */
28646  bool is_partial_equation () const noexcept override {
28647  return true;
28648  }
28649 
28650  /**
28651  * \brief Return a copy of the current node
28652  *
28653  * Recursively make a new copy/clone of the current node including
28654  * all members and return a pointer to the node. This is used for
28655  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28656  * ast.
28657  *
28658  * @return pointer to the clone/copy of the current node
28659  */
28660  PartialEquation* clone() const override {
28661  return new PartialEquation(*this);
28662  }
28663 
28664  /// \name Getters
28665  /// \{
28666 
28667  /**
28668  * \brief Return type (ast::AstNodeType) of ast node
28669  *
28670  * Every node in the ast has a type defined in ast::AstNodeType and this
28671  * function is used to retrieve the same.
28672  *
28673  * \return ast node type i.e. ast::AstNodeType::PARTIAL_EQUATION
28674  *
28675  * \sa Ast::get_node_type_name
28676  */
28677  AstNodeType get_node_type() const noexcept override {
28679  }
28680 
28681  /**
28682  * \brief Return type (ast::AstNodeType) of ast node as std::string
28683  *
28684  * Every node in the ast has a type defined in ast::AstNodeType.
28685  * This type name can be returned as a std::string for printing
28686  * node to text/json form.
28687  *
28688  * \return name of the node type as a string i.e. "PartialEquation"
28689  *
28690  * \sa Ast::get_node_name
28691  */
28692  std::string get_node_type_name() const noexcept override {
28693  return "PartialEquation";
28694  }
28695 
28696 
28697  /**
28698  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28699  */
28700  std::shared_ptr<Ast> get_shared_ptr() override {
28701  return std::static_pointer_cast<PartialEquation>(shared_from_this());
28702  }
28703 
28704  /**
28705  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28706  */
28707  std::shared_ptr<const Ast> get_shared_ptr() const override {
28708  return std::static_pointer_cast<const PartialEquation>(shared_from_this());
28709  }
28710 
28711  /**
28712  * \brief Return associated token for the current ast node
28713  *
28714  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
28715  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
28716  * nullptr to store in the nmodl::symtab::SymbolTable.
28717  *
28718  * \return pointer to token if exist otherwise nullptr
28719  */
28720  const ModToken* get_token() const noexcept override {
28721  return token.get();
28722  }
28723 
28724 
28725 
28726 
28727 
28728 
28729 
28730 
28731  /**
28732  * \brief Getter for member variable \ref PartialEquation.prime
28733  */
28734  const std::shared_ptr<PrimeName>& get_prime() const noexcept {
28735  return prime;
28736  }
28737 
28738 
28739 
28740 
28741 
28742 
28743 
28744  /**
28745  * \brief Getter for member variable \ref PartialEquation.name1
28746  */
28747  const std::shared_ptr<Name>& get_name1() const noexcept {
28748  return name1;
28749  }
28750 
28751 
28752 
28753 
28754 
28755 
28756 
28757  /**
28758  * \brief Getter for member variable \ref PartialEquation.name2
28759  */
28760  const std::shared_ptr<Name>& get_name2() const noexcept {
28761  return name2;
28762  }
28763 
28764 
28765 
28766 
28767 
28768 
28769 
28770  /**
28771  * \brief Getter for member variable \ref PartialEquation.name3
28772  */
28773  const std::shared_ptr<Name>& get_name3() const noexcept {
28774  return name3;
28775  }
28776 
28777 
28778 
28779  /// \}
28780 
28781  /// \name Setters
28782  /// \{
28783 
28784 
28785  /**
28786  * \brief Set token for the current ast node
28787  */
28788  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
28789 
28790 
28791 
28792 
28793  /**
28794  * \brief Setter for member variable \ref PartialEquation.prime (rvalue reference)
28795  */
28796  void set_prime(std::shared_ptr<PrimeName>&& prime);
28797 
28798  /**
28799  * \brief Setter for member variable \ref PartialEquation.prime
28800  */
28801  void set_prime(const std::shared_ptr<PrimeName>& prime);
28802 
28803 
28804  /**
28805  * \brief Setter for member variable \ref PartialEquation.name1 (rvalue reference)
28806  */
28807  void set_name1(std::shared_ptr<Name>&& name1);
28808 
28809  /**
28810  * \brief Setter for member variable \ref PartialEquation.name1
28811  */
28812  void set_name1(const std::shared_ptr<Name>& name1);
28813 
28814 
28815  /**
28816  * \brief Setter for member variable \ref PartialEquation.name2 (rvalue reference)
28817  */
28818  void set_name2(std::shared_ptr<Name>&& name2);
28819 
28820  /**
28821  * \brief Setter for member variable \ref PartialEquation.name2
28822  */
28823  void set_name2(const std::shared_ptr<Name>& name2);
28824 
28825 
28826  /**
28827  * \brief Setter for member variable \ref PartialEquation.name3 (rvalue reference)
28828  */
28829  void set_name3(std::shared_ptr<Name>&& name3);
28830 
28831  /**
28832  * \brief Setter for member variable \ref PartialEquation.name3
28833  */
28834  void set_name3(const std::shared_ptr<Name>& name3);
28835 
28836 
28837  /// \}
28838 
28839  /// \name Visitor
28840  /// \{
28841 
28842  /**
28843  * \brief visit children i.e. member variables of current node using provided visitor
28844  *
28845  * Different nodes in the AST have different members (i.e. children). This method
28846  * recursively visits children using provided visitor.
28847  *
28848  * \param v Concrete visitor that will be used to recursively visit children
28849  *
28850  * \sa Ast::visit_children for example.
28851  */
28852  void visit_children(visitor::Visitor& v) override;
28853 
28854  /**
28855  * \brief visit children i.e. member variables of current node using provided visitor
28856  *
28857  * Different nodes in the AST have different members (i.e. children). This method
28858  * recursively visits children using provided visitor.
28859  *
28860  * \param v Concrete constant visitor that will be used to recursively visit children
28861  *
28862  * \sa Ast::visit_children for example.
28863  */
28864  void visit_children(visitor::ConstVisitor& v) const override;
28865 
28866  /**
28867  * \brief accept (or visit) the current AST node using provided visitor
28868  *
28869  * Instead of visiting children of AST node, like Ast::visit_children,
28870  * accept allows to visit the current node itself using provided concrete
28871  * visitor.
28872  *
28873  * \param v Concrete visitor that will be used to recursively visit node
28874  *
28875  * \sa Ast::accept for example.
28876  */
28877  void accept(visitor::Visitor& v) override;
28878 
28879  /**
28880  * \copydoc accept(visitor::Visitor&)
28881  */
28882  void accept(visitor::ConstVisitor& v) const override;
28883 
28884  /// \}
28885 
28886 
28887 
28888  private:
28889  /**
28890  * \brief Set this object as parent for all the children
28891  *
28892  * This should be called in every object (with children) constructor
28893  * to set parents. Since it is called only in the constructors it
28894  * should not be virtual to avoid ambiguities (issue #295).
28895  */
28896  void set_parent_in_children();
28897 };
28898 
28899 /** @} */ // end of ast_class
28900 
28901 
28902 } // namespace ast
28903 } // namespace nmodl
28904 #endif // !NMODL_AST_PARTIAL_EQUATION_HPP
28905 #ifndef NMODL_AST_PARTIAL_BOUNDARY_HPP
28906 #define NMODL_AST_PARTIAL_BOUNDARY_HPP
28907 
28908 
28909 namespace nmodl {
28910 namespace ast {
28911 
28912 /**
28913  * @addtogroup ast_class
28914  * @ingroup ast
28915  * @{
28916  */
28917 
28918 /**
28919  * \brief TODO
28920  *
28921  *
28922 */
28923 class PartialBoundary : public Statement {
28924  private:
28925  /// TODO
28926  std::shared_ptr<Name> del;
28927  /// TODO
28928  std::shared_ptr<Identifier> name;
28929  /// TODO
28930  std::shared_ptr<FirstLastTypeIndex> index;
28931  /// TODO
28932  std::shared_ptr<Expression> expression;
28933  /// TODO
28934  std::shared_ptr<Name> name1;
28935  /// TODO
28936  std::shared_ptr<Name> del2;
28937  /// TODO
28938  std::shared_ptr<Name> name2;
28939  /// TODO
28940  std::shared_ptr<Name> name3;
28941  /// token with location information
28942  std::shared_ptr<ModToken> token;
28943 
28944  public:
28945 
28946  /// \name Ctor & dtor
28947  /// \{
28948 
28949  explicit PartialBoundary(Name* del, Identifier* name, FirstLastTypeIndex* index, Expression* expression, Name* name1, Name* del2, Name* name2, Name* name3);
28950  explicit PartialBoundary(const std::shared_ptr<Name>& del, const std::shared_ptr<Identifier>& name, const std::shared_ptr<FirstLastTypeIndex>& index, const std::shared_ptr<Expression>& expression, const std::shared_ptr<Name>& name1, const std::shared_ptr<Name>& del2, const std::shared_ptr<Name>& name2, const std::shared_ptr<Name>& name3);
28951  PartialBoundary(const PartialBoundary& obj);
28952 
28953 
28954  virtual ~PartialBoundary() = default;
28955 
28956  /// \}
28957 
28958 
28959 
28960 
28961 
28962 
28963  /**
28964  * \brief Check if the ast node is an instance of ast::PartialBoundary
28965  * \return true as object is of type ast::PartialBoundary
28966  */
28967  bool is_partial_boundary () const noexcept override {
28968  return true;
28969  }
28970 
28971  /**
28972  * \brief Return a copy of the current node
28973  *
28974  * Recursively make a new copy/clone of the current node including
28975  * all members and return a pointer to the node. This is used for
28976  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28977  * ast.
28978  *
28979  * @return pointer to the clone/copy of the current node
28980  */
28981  PartialBoundary* clone() const override {
28982  return new PartialBoundary(*this);
28983  }
28984 
28985  /// \name Getters
28986  /// \{
28987 
28988  /**
28989  * \brief Return type (ast::AstNodeType) of ast node
28990  *
28991  * Every node in the ast has a type defined in ast::AstNodeType and this
28992  * function is used to retrieve the same.
28993  *
28994  * \return ast node type i.e. ast::AstNodeType::PARTIAL_BOUNDARY
28995  *
28996  * \sa Ast::get_node_type_name
28997  */
28998  AstNodeType get_node_type() const noexcept override {
29000  }
29001 
29002  /**
29003  * \brief Return type (ast::AstNodeType) of ast node as std::string
29004  *
29005  * Every node in the ast has a type defined in ast::AstNodeType.
29006  * This type name can be returned as a std::string for printing
29007  * node to text/json form.
29008  *
29009  * \return name of the node type as a string i.e. "PartialBoundary"
29010  *
29011  * \sa Ast::get_node_name
29012  */
29013  std::string get_node_type_name() const noexcept override {
29014  return "PartialBoundary";
29015  }
29016 
29017  /**
29018  * \brief Return NMODL statement of ast node as std::string
29019  *
29020  * Every node is related to a special statement in the NMODL. This
29021  * statement can be returned as a std::string for printing to
29022  * text/json form.
29023  *
29024  * \return name of the statement as a string i.e. "~ "
29025  *
29026  * \sa Ast::get_nmodl_name
29027  */
29028  std::string get_nmodl_name() const noexcept override {
29029  return "~ ";
29030  }
29031 
29032  /**
29033  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29034  */
29035  std::shared_ptr<Ast> get_shared_ptr() override {
29036  return std::static_pointer_cast<PartialBoundary>(shared_from_this());
29037  }
29038 
29039  /**
29040  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29041  */
29042  std::shared_ptr<const Ast> get_shared_ptr() const override {
29043  return std::static_pointer_cast<const PartialBoundary>(shared_from_this());
29044  }
29045 
29046  /**
29047  * \brief Return associated token for the current ast node
29048  *
29049  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
29050  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
29051  * nullptr to store in the nmodl::symtab::SymbolTable.
29052  *
29053  * \return pointer to token if exist otherwise nullptr
29054  */
29055  const ModToken* get_token() const noexcept override {
29056  return token.get();
29057  }
29058 
29059 
29060 
29061 
29062 
29063 
29064 
29065 
29066  /**
29067  * \brief Getter for member variable \ref PartialBoundary.del
29068  */
29069  const std::shared_ptr<Name>& get_del() const noexcept {
29070  return del;
29071  }
29072 
29073 
29074 
29075 
29076 
29077 
29078 
29079  /**
29080  * \brief Getter for member variable \ref PartialBoundary.name
29081  */
29082  const std::shared_ptr<Identifier>& get_name() const noexcept {
29083  return name;
29084  }
29085 
29086 
29087 
29088 
29089 
29090 
29091 
29092  /**
29093  * \brief Getter for member variable \ref PartialBoundary.index
29094  */
29095  const std::shared_ptr<FirstLastTypeIndex>& get_index() const noexcept {
29096  return index;
29097  }
29098 
29099 
29100 
29101 
29102 
29103 
29104 
29105  /**
29106  * \brief Getter for member variable \ref PartialBoundary.expression
29107  */
29108  const std::shared_ptr<Expression>& get_expression() const noexcept {
29109  return expression;
29110  }
29111 
29112 
29113 
29114 
29115 
29116 
29117 
29118  /**
29119  * \brief Getter for member variable \ref PartialBoundary.name1
29120  */
29121  const std::shared_ptr<Name>& get_name1() const noexcept {
29122  return name1;
29123  }
29124 
29125 
29126 
29127 
29128 
29129 
29130 
29131  /**
29132  * \brief Getter for member variable \ref PartialBoundary.del2
29133  */
29134  const std::shared_ptr<Name>& get_del2() const noexcept {
29135  return del2;
29136  }
29137 
29138 
29139 
29140 
29141 
29142 
29143 
29144  /**
29145  * \brief Getter for member variable \ref PartialBoundary.name2
29146  */
29147  const std::shared_ptr<Name>& get_name2() const noexcept {
29148  return name2;
29149  }
29150 
29151 
29152 
29153 
29154 
29155 
29156 
29157  /**
29158  * \brief Getter for member variable \ref PartialBoundary.name3
29159  */
29160  const std::shared_ptr<Name>& get_name3() const noexcept {
29161  return name3;
29162  }
29163 
29164 
29165 
29166  /// \}
29167 
29168  /// \name Setters
29169  /// \{
29170 
29171 
29172  /**
29173  * \brief Set token for the current ast node
29174  */
29175  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
29176 
29177 
29178 
29179 
29180  /**
29181  * \brief Setter for member variable \ref PartialBoundary.del (rvalue reference)
29182  */
29183  void set_del(std::shared_ptr<Name>&& del);
29184 
29185  /**
29186  * \brief Setter for member variable \ref PartialBoundary.del
29187  */
29188  void set_del(const std::shared_ptr<Name>& del);
29189 
29190 
29191  /**
29192  * \brief Setter for member variable \ref PartialBoundary.name (rvalue reference)
29193  */
29194  void set_name(std::shared_ptr<Identifier>&& name);
29195 
29196  /**
29197  * \brief Setter for member variable \ref PartialBoundary.name
29198  */
29199  void set_name(const std::shared_ptr<Identifier>& name);
29200 
29201 
29202  /**
29203  * \brief Setter for member variable \ref PartialBoundary.index (rvalue reference)
29204  */
29205  void set_index(std::shared_ptr<FirstLastTypeIndex>&& index);
29206 
29207  /**
29208  * \brief Setter for member variable \ref PartialBoundary.index
29209  */
29210  void set_index(const std::shared_ptr<FirstLastTypeIndex>& index);
29211 
29212 
29213  /**
29214  * \brief Setter for member variable \ref PartialBoundary.expression (rvalue reference)
29215  */
29216  void set_expression(std::shared_ptr<Expression>&& expression);
29217 
29218  /**
29219  * \brief Setter for member variable \ref PartialBoundary.expression
29220  */
29221  void set_expression(const std::shared_ptr<Expression>& expression);
29222 
29223 
29224  /**
29225  * \brief Setter for member variable \ref PartialBoundary.name1 (rvalue reference)
29226  */
29227  void set_name1(std::shared_ptr<Name>&& name1);
29228 
29229  /**
29230  * \brief Setter for member variable \ref PartialBoundary.name1
29231  */
29232  void set_name1(const std::shared_ptr<Name>& name1);
29233 
29234 
29235  /**
29236  * \brief Setter for member variable \ref PartialBoundary.del2 (rvalue reference)
29237  */
29238  void set_del2(std::shared_ptr<Name>&& del2);
29239 
29240  /**
29241  * \brief Setter for member variable \ref PartialBoundary.del2
29242  */
29243  void set_del2(const std::shared_ptr<Name>& del2);
29244 
29245 
29246  /**
29247  * \brief Setter for member variable \ref PartialBoundary.name2 (rvalue reference)
29248  */
29249  void set_name2(std::shared_ptr<Name>&& name2);
29250 
29251  /**
29252  * \brief Setter for member variable \ref PartialBoundary.name2
29253  */
29254  void set_name2(const std::shared_ptr<Name>& name2);
29255 
29256 
29257  /**
29258  * \brief Setter for member variable \ref PartialBoundary.name3 (rvalue reference)
29259  */
29260  void set_name3(std::shared_ptr<Name>&& name3);
29261 
29262  /**
29263  * \brief Setter for member variable \ref PartialBoundary.name3
29264  */
29265  void set_name3(const std::shared_ptr<Name>& name3);
29266 
29267 
29268  /// \}
29269 
29270  /// \name Visitor
29271  /// \{
29272 
29273  /**
29274  * \brief visit children i.e. member variables of current node using provided visitor
29275  *
29276  * Different nodes in the AST have different members (i.e. children). This method
29277  * recursively visits children using provided visitor.
29278  *
29279  * \param v Concrete visitor that will be used to recursively visit children
29280  *
29281  * \sa Ast::visit_children for example.
29282  */
29283  void visit_children(visitor::Visitor& v) override;
29284 
29285  /**
29286  * \brief visit children i.e. member variables of current node using provided visitor
29287  *
29288  * Different nodes in the AST have different members (i.e. children). This method
29289  * recursively visits children using provided visitor.
29290  *
29291  * \param v Concrete constant visitor that will be used to recursively visit children
29292  *
29293  * \sa Ast::visit_children for example.
29294  */
29295  void visit_children(visitor::ConstVisitor& v) const override;
29296 
29297  /**
29298  * \brief accept (or visit) the current AST node using provided visitor
29299  *
29300  * Instead of visiting children of AST node, like Ast::visit_children,
29301  * accept allows to visit the current node itself using provided concrete
29302  * visitor.
29303  *
29304  * \param v Concrete visitor that will be used to recursively visit node
29305  *
29306  * \sa Ast::accept for example.
29307  */
29308  void accept(visitor::Visitor& v) override;
29309 
29310  /**
29311  * \copydoc accept(visitor::Visitor&)
29312  */
29313  void accept(visitor::ConstVisitor& v) const override;
29314 
29315  /// \}
29316 
29317 
29318 
29319  private:
29320  /**
29321  * \brief Set this object as parent for all the children
29322  *
29323  * This should be called in every object (with children) constructor
29324  * to set parents. Since it is called only in the constructors it
29325  * should not be virtual to avoid ambiguities (issue #295).
29326  */
29327  void set_parent_in_children();
29328 };
29329 
29330 /** @} */ // end of ast_class
29331 
29332 
29333 } // namespace ast
29334 } // namespace nmodl
29335 #endif // !NMODL_AST_PARTIAL_BOUNDARY_HPP
29336 #ifndef NMODL_AST_WATCH_STATEMENT_HPP
29337 #define NMODL_AST_WATCH_STATEMENT_HPP
29338 #define NMODL_AST_WATCH_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
29339 
29340 
29341 namespace nmodl {
29342 namespace ast {
29343 
29344 /**
29345  * @addtogroup ast_class
29346  * @ingroup ast
29347  * @{
29348  */
29349 
29350 /**
29351  * \brief Represent WATCH statement in NMODL
29352  *
29353  *
29354 */
29355 class WatchStatement : public Statement {
29356  private:
29357  /// Vector of watch statements
29359  /// token with location information
29360  std::shared_ptr<ModToken> token;
29361 
29362  public:
29363 
29364  /// \name Ctor & dtor
29365  /// \{
29366 
29367  explicit WatchStatement(WatchVector statements);
29368  WatchStatement(const WatchStatement& obj);
29369 
29370 
29371  virtual ~WatchStatement() = default;
29372 
29373  /// \}
29374 
29375 
29376 
29377 
29378 
29379 
29380  /**
29381  * \brief Check if the ast node is an instance of ast::WatchStatement
29382  * \return true as object is of type ast::WatchStatement
29383  */
29384  bool is_watch_statement () const noexcept override {
29385  return true;
29386  }
29387 
29388  /**
29389  * \brief Return a copy of the current node
29390  *
29391  * Recursively make a new copy/clone of the current node including
29392  * all members and return a pointer to the node. This is used for
29393  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29394  * ast.
29395  *
29396  * @return pointer to the clone/copy of the current node
29397  */
29398  WatchStatement* clone() const override {
29399  return new WatchStatement(*this);
29400  }
29401 
29402  /// \name Getters
29403  /// \{
29404 
29405  /**
29406  * \brief Return type (ast::AstNodeType) of ast node
29407  *
29408  * Every node in the ast has a type defined in ast::AstNodeType and this
29409  * function is used to retrieve the same.
29410  *
29411  * \return ast node type i.e. ast::AstNodeType::WATCH_STATEMENT
29412  *
29413  * \sa Ast::get_node_type_name
29414  */
29415  AstNodeType get_node_type() const noexcept override {
29417  }
29418 
29419  /**
29420  * \brief Return type (ast::AstNodeType) of ast node as std::string
29421  *
29422  * Every node in the ast has a type defined in ast::AstNodeType.
29423  * This type name can be returned as a std::string for printing
29424  * node to text/json form.
29425  *
29426  * \return name of the node type as a string i.e. "WatchStatement"
29427  *
29428  * \sa Ast::get_node_name
29429  */
29430  std::string get_node_type_name() const noexcept override {
29431  return "WatchStatement";
29432  }
29433 
29434  /**
29435  * \brief Return NMODL statement of ast node as std::string
29436  *
29437  * Every node is related to a special statement in the NMODL. This
29438  * statement can be returned as a std::string for printing to
29439  * text/json form.
29440  *
29441  * \return name of the statement as a string i.e. "WATCH "
29442  *
29443  * \sa Ast::get_nmodl_name
29444  */
29445  std::string get_nmodl_name() const noexcept override {
29446  return "WATCH ";
29447  }
29448 
29449  /**
29450  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29451  */
29452  std::shared_ptr<Ast> get_shared_ptr() override {
29453  return std::static_pointer_cast<WatchStatement>(shared_from_this());
29454  }
29455 
29456  /**
29457  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29458  */
29459  std::shared_ptr<const Ast> get_shared_ptr() const override {
29460  return std::static_pointer_cast<const WatchStatement>(shared_from_this());
29461  }
29462 
29463  /**
29464  * \brief Return associated token for the current ast node
29465  *
29466  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
29467  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
29468  * nullptr to store in the nmodl::symtab::SymbolTable.
29469  *
29470  * \return pointer to token if exist otherwise nullptr
29471  */
29472  const ModToken* get_token() const noexcept override {
29473  return token.get();
29474  }
29475 
29476 
29477 
29478 
29479 /**
29480  * \brief Add member to statements by raw pointer
29481  */
29482 void emplace_back_watch(Watch *n);
29483 
29484 /**
29485  * \brief Add member to statements by shared_ptr
29486  */
29487 void emplace_back_watch(std::shared_ptr<Watch> n);
29488 
29489 /**
29490  * \brief Erase member to statements
29491  */
29492 WatchVector::const_iterator erase_watch(WatchVector::const_iterator first);
29493 
29494 /**
29495  * \brief Erase members to statements
29496  */
29497 WatchVector::const_iterator erase_watch(WatchVector::const_iterator first, WatchVector::const_iterator last);
29498 
29499 /**
29500  * \brief Erase non-consecutive members to statements
29501  *
29502  * loosely following the cpp reference of remove_if
29503  */
29504 size_t erase_watch(std::unordered_set<Watch*>& to_be_erased);
29505 
29506 /**
29507  * \brief Insert member to statements
29508  */
29509 WatchVector::const_iterator insert_watch(WatchVector::const_iterator position, const std::shared_ptr<Watch>& n);
29510 
29511 /**
29512  * \brief Insert members to statements
29513  */
29514 template <class NodeType, class InputIterator>
29515 void insert_watch(WatchVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last);
29516 
29517 /**
29518  * \brief Reset member to statements
29519  */
29520 void reset_watch(WatchVector::const_iterator position, Watch* n);
29521 
29522 /**
29523  * \brief Reset member to statements
29524  */
29525 void reset_watch(WatchVector::const_iterator position, std::shared_ptr<Watch> n);
29526 
29527 
29528 
29529 
29530 
29531  /**
29532  * \brief Getter for member variable \ref WatchStatement.statements
29533  */
29534  const WatchVector& get_statements() const noexcept {
29535  return statements;
29536  }
29537 
29538 
29539 
29540  /// \}
29541 
29542  /// \name Setters
29543  /// \{
29544 
29545 
29546  /**
29547  * \brief Set token for the current ast node
29548  */
29549  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
29550 
29551 
29552 
29553 
29554  /**
29555  * \brief Setter for member variable \ref WatchStatement.statements (rvalue reference)
29556  */
29557  void set_statements(WatchVector&& statements);
29558 
29559  /**
29560  * \brief Setter for member variable \ref WatchStatement.statements
29561  */
29562  void set_statements(const WatchVector& statements);
29563 
29564 
29565  /// \}
29566 
29567  /// \name Visitor
29568  /// \{
29569 
29570  /**
29571  * \brief visit children i.e. member variables of current node using provided visitor
29572  *
29573  * Different nodes in the AST have different members (i.e. children). This method
29574  * recursively visits children using provided visitor.
29575  *
29576  * \param v Concrete visitor that will be used to recursively visit children
29577  *
29578  * \sa Ast::visit_children for example.
29579  */
29580  void visit_children(visitor::Visitor& v) override;
29581 
29582  /**
29583  * \brief visit children i.e. member variables of current node using provided visitor
29584  *
29585  * Different nodes in the AST have different members (i.e. children). This method
29586  * recursively visits children using provided visitor.
29587  *
29588  * \param v Concrete constant visitor that will be used to recursively visit children
29589  *
29590  * \sa Ast::visit_children for example.
29591  */
29592  void visit_children(visitor::ConstVisitor& v) const override;
29593 
29594  /**
29595  * \brief accept (or visit) the current AST node using provided visitor
29596  *
29597  * Instead of visiting children of AST node, like Ast::visit_children,
29598  * accept allows to visit the current node itself using provided concrete
29599  * visitor.
29600  *
29601  * \param v Concrete visitor that will be used to recursively visit node
29602  *
29603  * \sa Ast::accept for example.
29604  */
29605  void accept(visitor::Visitor& v) override;
29606 
29607  /**
29608  * \copydoc accept(visitor::Visitor&)
29609  */
29610  void accept(visitor::ConstVisitor& v) const override;
29611 
29612  /// \}
29613 
29614 
29615 
29616  private:
29617  /**
29618  * \brief Set this object as parent for all the children
29619  *
29620  * This should be called in every object (with children) constructor
29621  * to set parents. Since it is called only in the constructors it
29622  * should not be virtual to avoid ambiguities (issue #295).
29623  */
29624  void set_parent_in_children();
29625 };
29626 
29627 /** @} */ // end of ast_class
29628 
29629 
29630 } // namespace ast
29631 } // namespace nmodl
29632 #endif // !NMODL_AST_WATCH_STATEMENT_HPP
29633 #ifndef NMODL_AST_MUTEX_LOCK_HPP
29634 #define NMODL_AST_MUTEX_LOCK_HPP
29635 
29636 
29637 namespace nmodl {
29638 namespace ast {
29639 
29640 /**
29641  * @addtogroup ast_class
29642  * @ingroup ast
29643  * @{
29644  */
29645 
29646 /**
29647  * \brief Represent MUTEXLOCK statement in NMODL
29648  *
29649  *
29650 */
29651 class MutexLock : public Statement {
29652  private:
29653  /// token with location information
29654  std::shared_ptr<ModToken> token;
29655 
29656  public:
29657 
29658  /// \name Ctor & dtor
29659  /// \{
29660 
29661 
29662 
29663  virtual ~MutexLock() = default;
29664 
29665  /// \}
29666 
29667 
29668 
29669 
29670 
29671 
29672  /**
29673  * \brief Check if the ast node is an instance of ast::MutexLock
29674  * \return true as object is of type ast::MutexLock
29675  */
29676  bool is_mutex_lock () const noexcept override {
29677  return true;
29678  }
29679 
29680  /**
29681  * \brief Return a copy of the current node
29682  *
29683  * Recursively make a new copy/clone of the current node including
29684  * all members and return a pointer to the node. This is used for
29685  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29686  * ast.
29687  *
29688  * @return pointer to the clone/copy of the current node
29689  */
29690  MutexLock* clone() const override {
29691  return new MutexLock(*this);
29692  }
29693 
29694  /// \name Getters
29695  /// \{
29696 
29697  /**
29698  * \brief Return type (ast::AstNodeType) of ast node
29699  *
29700  * Every node in the ast has a type defined in ast::AstNodeType and this
29701  * function is used to retrieve the same.
29702  *
29703  * \return ast node type i.e. ast::AstNodeType::MUTEX_LOCK
29704  *
29705  * \sa Ast::get_node_type_name
29706  */
29707  AstNodeType get_node_type() const noexcept override {
29708  return AstNodeType::MUTEX_LOCK;
29709  }
29710 
29711  /**
29712  * \brief Return type (ast::AstNodeType) of ast node as std::string
29713  *
29714  * Every node in the ast has a type defined in ast::AstNodeType.
29715  * This type name can be returned as a std::string for printing
29716  * node to text/json form.
29717  *
29718  * \return name of the node type as a string i.e. "MutexLock"
29719  *
29720  * \sa Ast::get_node_name
29721  */
29722  std::string get_node_type_name() const noexcept override {
29723  return "MutexLock";
29724  }
29725 
29726  /**
29727  * \brief Return NMODL statement of ast node as std::string
29728  *
29729  * Every node is related to a special statement in the NMODL. This
29730  * statement can be returned as a std::string for printing to
29731  * text/json form.
29732  *
29733  * \return name of the statement as a string i.e. "MUTEXLOCK"
29734  *
29735  * \sa Ast::get_nmodl_name
29736  */
29737  std::string get_nmodl_name() const noexcept override {
29738  return "MUTEXLOCK";
29739  }
29740 
29741  /**
29742  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29743  */
29744  std::shared_ptr<Ast> get_shared_ptr() override {
29745  return std::static_pointer_cast<MutexLock>(shared_from_this());
29746  }
29747 
29748  /**
29749  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29750  */
29751  std::shared_ptr<const Ast> get_shared_ptr() const override {
29752  return std::static_pointer_cast<const MutexLock>(shared_from_this());
29753  }
29754 
29755  /**
29756  * \brief Return associated token for the current ast node
29757  *
29758  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
29759  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
29760  * nullptr to store in the nmodl::symtab::SymbolTable.
29761  *
29762  * \return pointer to token if exist otherwise nullptr
29763  */
29764  const ModToken* get_token() const noexcept override {
29765  return token.get();
29766  }
29767 
29768 
29769 
29770 
29771  /// \}
29772 
29773  /// \name Setters
29774  /// \{
29775 
29776 
29777  /**
29778  * \brief Set token for the current ast node
29779  */
29780  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
29781 
29782 
29783 
29784 
29785  /// \}
29786 
29787  /// \name Visitor
29788  /// \{
29789 
29790  /**
29791  * \brief visit children i.e. member variables of current node using provided visitor
29792  *
29793  * Different nodes in the AST have different members (i.e. children). This method
29794  * recursively visits children using provided visitor.
29795  *
29796  * \param v Concrete visitor that will be used to recursively visit children
29797  *
29798  * \sa Ast::visit_children for example.
29799  */
29800  void visit_children(visitor::Visitor& v) override;
29801 
29802  /**
29803  * \brief visit children i.e. member variables of current node using provided visitor
29804  *
29805  * Different nodes in the AST have different members (i.e. children). This method
29806  * recursively visits children using provided visitor.
29807  *
29808  * \param v Concrete constant visitor that will be used to recursively visit children
29809  *
29810  * \sa Ast::visit_children for example.
29811  */
29812  void visit_children(visitor::ConstVisitor& v) const override;
29813 
29814  /**
29815  * \brief accept (or visit) the current AST node using provided visitor
29816  *
29817  * Instead of visiting children of AST node, like Ast::visit_children,
29818  * accept allows to visit the current node itself using provided concrete
29819  * visitor.
29820  *
29821  * \param v Concrete visitor that will be used to recursively visit node
29822  *
29823  * \sa Ast::accept for example.
29824  */
29825  void accept(visitor::Visitor& v) override;
29826 
29827  /**
29828  * \copydoc accept(visitor::Visitor&)
29829  */
29830  void accept(visitor::ConstVisitor& v) const override;
29831 
29832  /// \}
29833 
29834 
29835 
29836 };
29837 
29838 /** @} */ // end of ast_class
29839 
29840 
29841 } // namespace ast
29842 } // namespace nmodl
29843 #endif // !NMODL_AST_MUTEX_LOCK_HPP
29844 #ifndef NMODL_AST_MUTEX_UNLOCK_HPP
29845 #define NMODL_AST_MUTEX_UNLOCK_HPP
29846 
29847 
29848 namespace nmodl {
29849 namespace ast {
29850 
29851 /**
29852  * @addtogroup ast_class
29853  * @ingroup ast
29854  * @{
29855  */
29856 
29857 /**
29858  * \brief Represent MUTEXUNLOCK statement in NMODL
29859  *
29860  *
29861 */
29862 class MutexUnlock : public Statement {
29863  private:
29864  /// token with location information
29865  std::shared_ptr<ModToken> token;
29866 
29867  public:
29868 
29869  /// \name Ctor & dtor
29870  /// \{
29871 
29872 
29873 
29874  virtual ~MutexUnlock() = default;
29875 
29876  /// \}
29877 
29878 
29879 
29880 
29881 
29882 
29883  /**
29884  * \brief Check if the ast node is an instance of ast::MutexUnlock
29885  * \return true as object is of type ast::MutexUnlock
29886  */
29887  bool is_mutex_unlock () const noexcept override {
29888  return true;
29889  }
29890 
29891  /**
29892  * \brief Return a copy of the current node
29893  *
29894  * Recursively make a new copy/clone of the current node including
29895  * all members and return a pointer to the node. This is used for
29896  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29897  * ast.
29898  *
29899  * @return pointer to the clone/copy of the current node
29900  */
29901  MutexUnlock* clone() const override {
29902  return new MutexUnlock(*this);
29903  }
29904 
29905  /// \name Getters
29906  /// \{
29907 
29908  /**
29909  * \brief Return type (ast::AstNodeType) of ast node
29910  *
29911  * Every node in the ast has a type defined in ast::AstNodeType and this
29912  * function is used to retrieve the same.
29913  *
29914  * \return ast node type i.e. ast::AstNodeType::MUTEX_UNLOCK
29915  *
29916  * \sa Ast::get_node_type_name
29917  */
29918  AstNodeType get_node_type() const noexcept override {
29920  }
29921 
29922  /**
29923  * \brief Return type (ast::AstNodeType) of ast node as std::string
29924  *
29925  * Every node in the ast has a type defined in ast::AstNodeType.
29926  * This type name can be returned as a std::string for printing
29927  * node to text/json form.
29928  *
29929  * \return name of the node type as a string i.e. "MutexUnlock"
29930  *
29931  * \sa Ast::get_node_name
29932  */
29933  std::string get_node_type_name() const noexcept override {
29934  return "MutexUnlock";
29935  }
29936 
29937  /**
29938  * \brief Return NMODL statement of ast node as std::string
29939  *
29940  * Every node is related to a special statement in the NMODL. This
29941  * statement can be returned as a std::string for printing to
29942  * text/json form.
29943  *
29944  * \return name of the statement as a string i.e. "MUTEXUNLOCK"
29945  *
29946  * \sa Ast::get_nmodl_name
29947  */
29948  std::string get_nmodl_name() const noexcept override {
29949  return "MUTEXUNLOCK";
29950  }
29951 
29952  /**
29953  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29954  */
29955  std::shared_ptr<Ast> get_shared_ptr() override {
29956  return std::static_pointer_cast<MutexUnlock>(shared_from_this());
29957  }
29958 
29959  /**
29960  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29961  */
29962  std::shared_ptr<const Ast> get_shared_ptr() const override {
29963  return std::static_pointer_cast<const MutexUnlock>(shared_from_this());
29964  }
29965 
29966  /**
29967  * \brief Return associated token for the current ast node
29968  *
29969  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
29970  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
29971  * nullptr to store in the nmodl::symtab::SymbolTable.
29972  *
29973  * \return pointer to token if exist otherwise nullptr
29974  */
29975  const ModToken* get_token() const noexcept override {
29976  return token.get();
29977  }
29978 
29979 
29980 
29981 
29982  /// \}
29983 
29984  /// \name Setters
29985  /// \{
29986 
29987 
29988  /**
29989  * \brief Set token for the current ast node
29990  */
29991  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
29992 
29993 
29994 
29995 
29996  /// \}
29997 
29998  /// \name Visitor
29999  /// \{
30000 
30001  /**
30002  * \brief visit children i.e. member variables of current node using provided visitor
30003  *
30004  * Different nodes in the AST have different members (i.e. children). This method
30005  * recursively visits children using provided visitor.
30006  *
30007  * \param v Concrete visitor that will be used to recursively visit children
30008  *
30009  * \sa Ast::visit_children for example.
30010  */
30011  void visit_children(visitor::Visitor& v) override;
30012 
30013  /**
30014  * \brief visit children i.e. member variables of current node using provided visitor
30015  *
30016  * Different nodes in the AST have different members (i.e. children). This method
30017  * recursively visits children using provided visitor.
30018  *
30019  * \param v Concrete constant visitor that will be used to recursively visit children
30020  *
30021  * \sa Ast::visit_children for example.
30022  */
30023  void visit_children(visitor::ConstVisitor& v) const override;
30024 
30025  /**
30026  * \brief accept (or visit) the current AST node using provided visitor
30027  *
30028  * Instead of visiting children of AST node, like Ast::visit_children,
30029  * accept allows to visit the current node itself using provided concrete
30030  * visitor.
30031  *
30032  * \param v Concrete visitor that will be used to recursively visit node
30033  *
30034  * \sa Ast::accept for example.
30035  */
30036  void accept(visitor::Visitor& v) override;
30037 
30038  /**
30039  * \copydoc accept(visitor::Visitor&)
30040  */
30041  void accept(visitor::ConstVisitor& v) const override;
30042 
30043  /// \}
30044 
30045 
30046 
30047 };
30048 
30049 /** @} */ // end of ast_class
30050 
30051 
30052 } // namespace ast
30053 } // namespace nmodl
30054 #endif // !NMODL_AST_MUTEX_UNLOCK_HPP
30055 #ifndef NMODL_AST_RESET_HPP
30056 #define NMODL_AST_RESET_HPP
30057 
30058 
30059 namespace nmodl {
30060 namespace ast {
30061 
30062 /**
30063  * @addtogroup ast_class
30064  * @ingroup ast
30065  * @{
30066  */
30067 
30068 /**
30069  * \brief Represent RESET statement in NMODL
30070  *
30071  *
30072 */
30073 class Reset : public Statement {
30074  private:
30075  /// token with location information
30076  std::shared_ptr<ModToken> token;
30077 
30078  public:
30079 
30080  /// \name Ctor & dtor
30081  /// \{
30082 
30083 
30084 
30085  virtual ~Reset() = default;
30086 
30087  /// \}
30088 
30089 
30090 
30091 
30092 
30093 
30094  /**
30095  * \brief Check if the ast node is an instance of ast::Reset
30096  * \return true as object is of type ast::Reset
30097  */
30098  bool is_reset () const noexcept override {
30099  return true;
30100  }
30101 
30102  /**
30103  * \brief Return a copy of the current node
30104  *
30105  * Recursively make a new copy/clone of the current node including
30106  * all members and return a pointer to the node. This is used for
30107  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30108  * ast.
30109  *
30110  * @return pointer to the clone/copy of the current node
30111  */
30112  Reset* clone() const override {
30113  return new Reset(*this);
30114  }
30115 
30116  /// \name Getters
30117  /// \{
30118 
30119  /**
30120  * \brief Return type (ast::AstNodeType) of ast node
30121  *
30122  * Every node in the ast has a type defined in ast::AstNodeType and this
30123  * function is used to retrieve the same.
30124  *
30125  * \return ast node type i.e. ast::AstNodeType::RESET
30126  *
30127  * \sa Ast::get_node_type_name
30128  */
30129  AstNodeType get_node_type() const noexcept override {
30130  return AstNodeType::RESET;
30131  }
30132 
30133  /**
30134  * \brief Return type (ast::AstNodeType) of ast node as std::string
30135  *
30136  * Every node in the ast has a type defined in ast::AstNodeType.
30137  * This type name can be returned as a std::string for printing
30138  * node to text/json form.
30139  *
30140  * \return name of the node type as a string i.e. "Reset"
30141  *
30142  * \sa Ast::get_node_name
30143  */
30144  std::string get_node_type_name() const noexcept override {
30145  return "Reset";
30146  }
30147 
30148  /**
30149  * \brief Return NMODL statement of ast node as std::string
30150  *
30151  * Every node is related to a special statement in the NMODL. This
30152  * statement can be returned as a std::string for printing to
30153  * text/json form.
30154  *
30155  * \return name of the statement as a string i.e. "RESET"
30156  *
30157  * \sa Ast::get_nmodl_name
30158  */
30159  std::string get_nmodl_name() const noexcept override {
30160  return "RESET";
30161  }
30162 
30163  /**
30164  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30165  */
30166  std::shared_ptr<Ast> get_shared_ptr() override {
30167  return std::static_pointer_cast<Reset>(shared_from_this());
30168  }
30169 
30170  /**
30171  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30172  */
30173  std::shared_ptr<const Ast> get_shared_ptr() const override {
30174  return std::static_pointer_cast<const Reset>(shared_from_this());
30175  }
30176 
30177  /**
30178  * \brief Return associated token for the current ast node
30179  *
30180  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
30181  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
30182  * nullptr to store in the nmodl::symtab::SymbolTable.
30183  *
30184  * \return pointer to token if exist otherwise nullptr
30185  */
30186  const ModToken* get_token() const noexcept override {
30187  return token.get();
30188  }
30189 
30190 
30191 
30192 
30193  /// \}
30194 
30195  /// \name Setters
30196  /// \{
30197 
30198 
30199  /**
30200  * \brief Set token for the current ast node
30201  */
30202  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
30203 
30204 
30205 
30206 
30207  /// \}
30208 
30209  /// \name Visitor
30210  /// \{
30211 
30212  /**
30213  * \brief visit children i.e. member variables of current node using provided visitor
30214  *
30215  * Different nodes in the AST have different members (i.e. children). This method
30216  * recursively visits children using provided visitor.
30217  *
30218  * \param v Concrete visitor that will be used to recursively visit children
30219  *
30220  * \sa Ast::visit_children for example.
30221  */
30222  void visit_children(visitor::Visitor& v) override;
30223 
30224  /**
30225  * \brief visit children i.e. member variables of current node using provided visitor
30226  *
30227  * Different nodes in the AST have different members (i.e. children). This method
30228  * recursively visits children using provided visitor.
30229  *
30230  * \param v Concrete constant visitor that will be used to recursively visit children
30231  *
30232  * \sa Ast::visit_children for example.
30233  */
30234  void visit_children(visitor::ConstVisitor& v) const override;
30235 
30236  /**
30237  * \brief accept (or visit) the current AST node using provided visitor
30238  *
30239  * Instead of visiting children of AST node, like Ast::visit_children,
30240  * accept allows to visit the current node itself using provided concrete
30241  * visitor.
30242  *
30243  * \param v Concrete visitor that will be used to recursively visit node
30244  *
30245  * \sa Ast::accept for example.
30246  */
30247  void accept(visitor::Visitor& v) override;
30248 
30249  /**
30250  * \copydoc accept(visitor::Visitor&)
30251  */
30252  void accept(visitor::ConstVisitor& v) const override;
30253 
30254  /// \}
30255 
30256 
30257 
30258 };
30259 
30260 /** @} */ // end of ast_class
30261 
30262 
30263 } // namespace ast
30264 } // namespace nmodl
30265 #endif // !NMODL_AST_RESET_HPP
30266 #ifndef NMODL_AST_SENS_HPP
30267 #define NMODL_AST_SENS_HPP
30268 
30269 
30270 namespace nmodl {
30271 namespace ast {
30272 
30273 /**
30274  * @addtogroup ast_class
30275  * @ingroup ast
30276  * @{
30277  */
30278 
30279 /**
30280  * \brief Represent SENS statement in NMODL
30281  *
30282  *
30283 */
30284 class Sens : public Statement {
30285  private:
30286  /// TODO
30288  /// token with location information
30289  std::shared_ptr<ModToken> token;
30290 
30291  public:
30292 
30293  /// \name Ctor & dtor
30294  /// \{
30295 
30296  explicit Sens(VarNameVector variables);
30297  Sens(const Sens& obj);
30298 
30299 
30300  virtual ~Sens() = default;
30301 
30302  /// \}
30303 
30304 
30305 
30306 
30307 
30308 
30309  /**
30310  * \brief Check if the ast node is an instance of ast::Sens
30311  * \return true as object is of type ast::Sens
30312  */
30313  bool is_sens () const noexcept override {
30314  return true;
30315  }
30316 
30317  /**
30318  * \brief Return a copy of the current node
30319  *
30320  * Recursively make a new copy/clone of the current node including
30321  * all members and return a pointer to the node. This is used for
30322  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30323  * ast.
30324  *
30325  * @return pointer to the clone/copy of the current node
30326  */
30327  Sens* clone() const override {
30328  return new Sens(*this);
30329  }
30330 
30331  /// \name Getters
30332  /// \{
30333 
30334  /**
30335  * \brief Return type (ast::AstNodeType) of ast node
30336  *
30337  * Every node in the ast has a type defined in ast::AstNodeType and this
30338  * function is used to retrieve the same.
30339  *
30340  * \return ast node type i.e. ast::AstNodeType::SENS
30341  *
30342  * \sa Ast::get_node_type_name
30343  */
30344  AstNodeType get_node_type() const noexcept override {
30345  return AstNodeType::SENS;
30346  }
30347 
30348  /**
30349  * \brief Return type (ast::AstNodeType) of ast node as std::string
30350  *
30351  * Every node in the ast has a type defined in ast::AstNodeType.
30352  * This type name can be returned as a std::string for printing
30353  * node to text/json form.
30354  *
30355  * \return name of the node type as a string i.e. "Sens"
30356  *
30357  * \sa Ast::get_node_name
30358  */
30359  std::string get_node_type_name() const noexcept override {
30360  return "Sens";
30361  }
30362 
30363  /**
30364  * \brief Return NMODL statement of ast node as std::string
30365  *
30366  * Every node is related to a special statement in the NMODL. This
30367  * statement can be returned as a std::string for printing to
30368  * text/json form.
30369  *
30370  * \return name of the statement as a string i.e. "SENS "
30371  *
30372  * \sa Ast::get_nmodl_name
30373  */
30374  std::string get_nmodl_name() const noexcept override {
30375  return "SENS ";
30376  }
30377 
30378  /**
30379  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30380  */
30381  std::shared_ptr<Ast> get_shared_ptr() override {
30382  return std::static_pointer_cast<Sens>(shared_from_this());
30383  }
30384 
30385  /**
30386  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30387  */
30388  std::shared_ptr<const Ast> get_shared_ptr() const override {
30389  return std::static_pointer_cast<const Sens>(shared_from_this());
30390  }
30391 
30392  /**
30393  * \brief Return associated token for the current ast node
30394  *
30395  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
30396  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
30397  * nullptr to store in the nmodl::symtab::SymbolTable.
30398  *
30399  * \return pointer to token if exist otherwise nullptr
30400  */
30401  const ModToken* get_token() const noexcept override {
30402  return token.get();
30403  }
30404 
30405 
30406 
30407 
30408 
30409 
30410 
30411 
30412  /**
30413  * \brief Getter for member variable \ref Sens.variables
30414  */
30415  const VarNameVector& get_variables() const noexcept {
30416  return variables;
30417  }
30418 
30419 
30420 
30421  /// \}
30422 
30423  /// \name Setters
30424  /// \{
30425 
30426 
30427  /**
30428  * \brief Set token for the current ast node
30429  */
30430  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
30431 
30432 
30433 
30434 
30435  /**
30436  * \brief Setter for member variable \ref Sens.variables (rvalue reference)
30437  */
30438  void set_variables(VarNameVector&& variables);
30439 
30440  /**
30441  * \brief Setter for member variable \ref Sens.variables
30442  */
30443  void set_variables(const VarNameVector& variables);
30444 
30445 
30446  /// \}
30447 
30448  /// \name Visitor
30449  /// \{
30450 
30451  /**
30452  * \brief visit children i.e. member variables of current node using provided visitor
30453  *
30454  * Different nodes in the AST have different members (i.e. children). This method
30455  * recursively visits children using provided visitor.
30456  *
30457  * \param v Concrete visitor that will be used to recursively visit children
30458  *
30459  * \sa Ast::visit_children for example.
30460  */
30461  void visit_children(visitor::Visitor& v) override;
30462 
30463  /**
30464  * \brief visit children i.e. member variables of current node using provided visitor
30465  *
30466  * Different nodes in the AST have different members (i.e. children). This method
30467  * recursively visits children using provided visitor.
30468  *
30469  * \param v Concrete constant visitor that will be used to recursively visit children
30470  *
30471  * \sa Ast::visit_children for example.
30472  */
30473  void visit_children(visitor::ConstVisitor& v) const override;
30474 
30475  /**
30476  * \brief accept (or visit) the current AST node using provided visitor
30477  *
30478  * Instead of visiting children of AST node, like Ast::visit_children,
30479  * accept allows to visit the current node itself using provided concrete
30480  * visitor.
30481  *
30482  * \param v Concrete visitor that will be used to recursively visit node
30483  *
30484  * \sa Ast::accept for example.
30485  */
30486  void accept(visitor::Visitor& v) override;
30487 
30488  /**
30489  * \copydoc accept(visitor::Visitor&)
30490  */
30491  void accept(visitor::ConstVisitor& v) const override;
30492 
30493  /// \}
30494 
30495 
30496 
30497  private:
30498  /**
30499  * \brief Set this object as parent for all the children
30500  *
30501  * This should be called in every object (with children) constructor
30502  * to set parents. Since it is called only in the constructors it
30503  * should not be virtual to avoid ambiguities (issue #295).
30504  */
30505  void set_parent_in_children();
30506 };
30507 
30508 /** @} */ // end of ast_class
30509 
30510 
30511 } // namespace ast
30512 } // namespace nmodl
30513 #endif // !NMODL_AST_SENS_HPP
30514 #ifndef NMODL_AST_CONSERVE_HPP
30515 #define NMODL_AST_CONSERVE_HPP
30516 
30517 
30518 namespace nmodl {
30519 namespace ast {
30520 
30521 /**
30522  * @addtogroup ast_class
30523  * @ingroup ast
30524  * @{
30525  */
30526 
30527 /**
30528  * \brief Represent CONSERVE statement in NMODL
30529  *
30530  *
30531 */
30532 class Conserve : public Statement {
30533  private:
30534  /// TODO
30535  std::shared_ptr<Expression> react;
30536  /// TODO
30537  std::shared_ptr<Expression> expr;
30538  /// token with location information
30539  std::shared_ptr<ModToken> token;
30540 
30541  public:
30542 
30543  /// \name Ctor & dtor
30544  /// \{
30545 
30546  explicit Conserve(Expression* react, Expression* expr);
30547  explicit Conserve(const std::shared_ptr<Expression>& react, const std::shared_ptr<Expression>& expr);
30548  Conserve(const Conserve& obj);
30549 
30550 
30551  virtual ~Conserve() = default;
30552 
30553  /// \}
30554 
30555 
30556 
30557 
30558 
30559 
30560  /**
30561  * \brief Check if the ast node is an instance of ast::Conserve
30562  * \return true as object is of type ast::Conserve
30563  */
30564  bool is_conserve () const noexcept override {
30565  return true;
30566  }
30567 
30568  /**
30569  * \brief Return a copy of the current node
30570  *
30571  * Recursively make a new copy/clone of the current node including
30572  * all members and return a pointer to the node. This is used for
30573  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30574  * ast.
30575  *
30576  * @return pointer to the clone/copy of the current node
30577  */
30578  Conserve* clone() const override {
30579  return new Conserve(*this);
30580  }
30581 
30582  /// \name Getters
30583  /// \{
30584 
30585  /**
30586  * \brief Return type (ast::AstNodeType) of ast node
30587  *
30588  * Every node in the ast has a type defined in ast::AstNodeType and this
30589  * function is used to retrieve the same.
30590  *
30591  * \return ast node type i.e. ast::AstNodeType::CONSERVE
30592  *
30593  * \sa Ast::get_node_type_name
30594  */
30595  AstNodeType get_node_type() const noexcept override {
30596  return AstNodeType::CONSERVE;
30597  }
30598 
30599  /**
30600  * \brief Return type (ast::AstNodeType) of ast node as std::string
30601  *
30602  * Every node in the ast has a type defined in ast::AstNodeType.
30603  * This type name can be returned as a std::string for printing
30604  * node to text/json form.
30605  *
30606  * \return name of the node type as a string i.e. "Conserve"
30607  *
30608  * \sa Ast::get_node_name
30609  */
30610  std::string get_node_type_name() const noexcept override {
30611  return "Conserve";
30612  }
30613 
30614  /**
30615  * \brief Return NMODL statement of ast node as std::string
30616  *
30617  * Every node is related to a special statement in the NMODL. This
30618  * statement can be returned as a std::string for printing to
30619  * text/json form.
30620  *
30621  * \return name of the statement as a string i.e. "CONSERVE"
30622  *
30623  * \sa Ast::get_nmodl_name
30624  */
30625  std::string get_nmodl_name() const noexcept override {
30626  return "CONSERVE";
30627  }
30628 
30629  /**
30630  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30631  */
30632  std::shared_ptr<Ast> get_shared_ptr() override {
30633  return std::static_pointer_cast<Conserve>(shared_from_this());
30634  }
30635 
30636  /**
30637  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30638  */
30639  std::shared_ptr<const Ast> get_shared_ptr() const override {
30640  return std::static_pointer_cast<const Conserve>(shared_from_this());
30641  }
30642 
30643  /**
30644  * \brief Return associated token for the current ast node
30645  *
30646  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
30647  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
30648  * nullptr to store in the nmodl::symtab::SymbolTable.
30649  *
30650  * \return pointer to token if exist otherwise nullptr
30651  */
30652  const ModToken* get_token() const noexcept override {
30653  return token.get();
30654  }
30655 
30656 
30657 
30658 
30659 
30660 
30661 
30662 
30663  /**
30664  * \brief Getter for member variable \ref Conserve.react
30665  */
30666  const std::shared_ptr<Expression>& get_react() const noexcept {
30667  return react;
30668  }
30669 
30670 
30671 
30672 
30673 
30674 
30675 
30676  /**
30677  * \brief Getter for member variable \ref Conserve.expr
30678  */
30679  const std::shared_ptr<Expression>& get_expr() const noexcept {
30680  return expr;
30681  }
30682 
30683 
30684 
30685  /// \}
30686 
30687  /// \name Setters
30688  /// \{
30689 
30690 
30691  /**
30692  * \brief Set token for the current ast node
30693  */
30694  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
30695 
30696 
30697 
30698 
30699  /**
30700  * \brief Setter for member variable \ref Conserve.react (rvalue reference)
30701  */
30702  void set_react(std::shared_ptr<Expression>&& react);
30703 
30704  /**
30705  * \brief Setter for member variable \ref Conserve.react
30706  */
30707  void set_react(const std::shared_ptr<Expression>& react);
30708 
30709 
30710  /**
30711  * \brief Setter for member variable \ref Conserve.expr (rvalue reference)
30712  */
30713  void set_expr(std::shared_ptr<Expression>&& expr);
30714 
30715  /**
30716  * \brief Setter for member variable \ref Conserve.expr
30717  */
30718  void set_expr(const std::shared_ptr<Expression>& expr);
30719 
30720 
30721  /// \}
30722 
30723  /// \name Visitor
30724  /// \{
30725 
30726  /**
30727  * \brief visit children i.e. member variables of current node using provided visitor
30728  *
30729  * Different nodes in the AST have different members (i.e. children). This method
30730  * recursively visits children using provided visitor.
30731  *
30732  * \param v Concrete visitor that will be used to recursively visit children
30733  *
30734  * \sa Ast::visit_children for example.
30735  */
30736  void visit_children(visitor::Visitor& v) override;
30737 
30738  /**
30739  * \brief visit children i.e. member variables of current node using provided visitor
30740  *
30741  * Different nodes in the AST have different members (i.e. children). This method
30742  * recursively visits children using provided visitor.
30743  *
30744  * \param v Concrete constant visitor that will be used to recursively visit children
30745  *
30746  * \sa Ast::visit_children for example.
30747  */
30748  void visit_children(visitor::ConstVisitor& v) const override;
30749 
30750  /**
30751  * \brief accept (or visit) the current AST node using provided visitor
30752  *
30753  * Instead of visiting children of AST node, like Ast::visit_children,
30754  * accept allows to visit the current node itself using provided concrete
30755  * visitor.
30756  *
30757  * \param v Concrete visitor that will be used to recursively visit node
30758  *
30759  * \sa Ast::accept for example.
30760  */
30761  void accept(visitor::Visitor& v) override;
30762 
30763  /**
30764  * \copydoc accept(visitor::Visitor&)
30765  */
30766  void accept(visitor::ConstVisitor& v) const override;
30767 
30768  /// \}
30769 
30770 
30771 
30772  private:
30773  /**
30774  * \brief Set this object as parent for all the children
30775  *
30776  * This should be called in every object (with children) constructor
30777  * to set parents. Since it is called only in the constructors it
30778  * should not be virtual to avoid ambiguities (issue #295).
30779  */
30780  void set_parent_in_children();
30781 };
30782 
30783 /** @} */ // end of ast_class
30784 
30785 
30786 } // namespace ast
30787 } // namespace nmodl
30788 #endif // !NMODL_AST_CONSERVE_HPP
30789 #ifndef NMODL_AST_COMPARTMENT_HPP
30790 #define NMODL_AST_COMPARTMENT_HPP
30791 
30792 
30793 namespace nmodl {
30794 namespace ast {
30795 
30796 /**
30797  * @addtogroup ast_class
30798  * @ingroup ast
30799  * @{
30800  */
30801 
30802 /**
30803  * \brief Represent COMPARTMENT statement in NMODL
30804  *
30805  *
30806 */
30807 class Compartment : public Statement {
30808  private:
30809  /// TODO
30810  std::shared_ptr<Name> name;
30811  /// TODO
30812  std::shared_ptr<Expression> expression;
30813  /// TODO
30815  /// token with location information
30816  std::shared_ptr<ModToken> token;
30817 
30818  public:
30819 
30820  /// \name Ctor & dtor
30821  /// \{
30822 
30823  explicit Compartment(Name* name, Expression* expression, NameVector names);
30824  explicit Compartment(const std::shared_ptr<Name>& name, const std::shared_ptr<Expression>& expression, const NameVector& names);
30825  Compartment(const Compartment& obj);
30826 
30827 
30828  virtual ~Compartment() = default;
30829 
30830  /// \}
30831 
30832 
30833 
30834 
30835 
30836 
30837  /**
30838  * \brief Check if the ast node is an instance of ast::Compartment
30839  * \return true as object is of type ast::Compartment
30840  */
30841  bool is_compartment () const noexcept override {
30842  return true;
30843  }
30844 
30845  /**
30846  * \brief Return a copy of the current node
30847  *
30848  * Recursively make a new copy/clone of the current node including
30849  * all members and return a pointer to the node. This is used for
30850  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30851  * ast.
30852  *
30853  * @return pointer to the clone/copy of the current node
30854  */
30855  Compartment* clone() const override {
30856  return new Compartment(*this);
30857  }
30858 
30859  /// \name Getters
30860  /// \{
30861 
30862  /**
30863  * \brief Return type (ast::AstNodeType) of ast node
30864  *
30865  * Every node in the ast has a type defined in ast::AstNodeType and this
30866  * function is used to retrieve the same.
30867  *
30868  * \return ast node type i.e. ast::AstNodeType::COMPARTMENT
30869  *
30870  * \sa Ast::get_node_type_name
30871  */
30872  AstNodeType get_node_type() const noexcept override {
30873  return AstNodeType::COMPARTMENT;
30874  }
30875 
30876  /**
30877  * \brief Return type (ast::AstNodeType) of ast node as std::string
30878  *
30879  * Every node in the ast has a type defined in ast::AstNodeType.
30880  * This type name can be returned as a std::string for printing
30881  * node to text/json form.
30882  *
30883  * \return name of the node type as a string i.e. "Compartment"
30884  *
30885  * \sa Ast::get_node_name
30886  */
30887  std::string get_node_type_name() const noexcept override {
30888  return "Compartment";
30889  }
30890 
30891  /**
30892  * \brief Return NMODL statement of ast node as std::string
30893  *
30894  * Every node is related to a special statement in the NMODL. This
30895  * statement can be returned as a std::string for printing to
30896  * text/json form.
30897  *
30898  * \return name of the statement as a string i.e. "COMPARTMENT"
30899  *
30900  * \sa Ast::get_nmodl_name
30901  */
30902  std::string get_nmodl_name() const noexcept override {
30903  return "COMPARTMENT";
30904  }
30905 
30906  /**
30907  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30908  */
30909  std::shared_ptr<Ast> get_shared_ptr() override {
30910  return std::static_pointer_cast<Compartment>(shared_from_this());
30911  }
30912 
30913  /**
30914  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30915  */
30916  std::shared_ptr<const Ast> get_shared_ptr() const override {
30917  return std::static_pointer_cast<const Compartment>(shared_from_this());
30918  }
30919 
30920  /**
30921  * \brief Return associated token for the current ast node
30922  *
30923  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
30924  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
30925  * nullptr to store in the nmodl::symtab::SymbolTable.
30926  *
30927  * \return pointer to token if exist otherwise nullptr
30928  */
30929  const ModToken* get_token() const noexcept override {
30930  return token.get();
30931  }
30932 
30933 
30934 
30935 
30936 
30937 
30938 
30939 
30940  /**
30941  * \brief Getter for member variable \ref Compartment.name
30942  */
30943  const std::shared_ptr<Name>& get_name() const noexcept {
30944  return name;
30945  }
30946 
30947 
30948 
30949 
30950 
30951 
30952 
30953  /**
30954  * \brief Getter for member variable \ref Compartment.expression
30955  */
30956  const std::shared_ptr<Expression>& get_expression() const noexcept {
30957  return expression;
30958  }
30959 
30960 
30961 
30962 
30963 
30964 
30965 
30966  /**
30967  * \brief Getter for member variable \ref Compartment.names
30968  */
30969  const NameVector& get_names() const noexcept {
30970  return names;
30971  }
30972 
30973 
30974 
30975  /// \}
30976 
30977  /// \name Setters
30978  /// \{
30979 
30980 
30981  /**
30982  * \brief Set token for the current ast node
30983  */
30984  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
30985 
30986 
30987 
30988 
30989  /**
30990  * \brief Setter for member variable \ref Compartment.name (rvalue reference)
30991  */
30992  void set_name(std::shared_ptr<Name>&& name);
30993 
30994  /**
30995  * \brief Setter for member variable \ref Compartment.name
30996  */
30997  void set_name(const std::shared_ptr<Name>& name);
30998 
30999 
31000  /**
31001  * \brief Setter for member variable \ref Compartment.expression (rvalue reference)
31002  */
31003  void set_expression(std::shared_ptr<Expression>&& expression);
31004 
31005  /**
31006  * \brief Setter for member variable \ref Compartment.expression
31007  */
31008  void set_expression(const std::shared_ptr<Expression>& expression);
31009 
31010 
31011  /**
31012  * \brief Setter for member variable \ref Compartment.names (rvalue reference)
31013  */
31014  void set_names(NameVector&& names);
31015 
31016  /**
31017  * \brief Setter for member variable \ref Compartment.names
31018  */
31019  void set_names(const NameVector& names);
31020 
31021 
31022  /// \}
31023 
31024  /// \name Visitor
31025  /// \{
31026 
31027  /**
31028  * \brief visit children i.e. member variables of current node using provided visitor
31029  *
31030  * Different nodes in the AST have different members (i.e. children). This method
31031  * recursively visits children using provided visitor.
31032  *
31033  * \param v Concrete visitor that will be used to recursively visit children
31034  *
31035  * \sa Ast::visit_children for example.
31036  */
31037  void visit_children(visitor::Visitor& v) override;
31038 
31039  /**
31040  * \brief visit children i.e. member variables of current node using provided visitor
31041  *
31042  * Different nodes in the AST have different members (i.e. children). This method
31043  * recursively visits children using provided visitor.
31044  *
31045  * \param v Concrete constant visitor that will be used to recursively visit children
31046  *
31047  * \sa Ast::visit_children for example.
31048  */
31049  void visit_children(visitor::ConstVisitor& v) const override;
31050 
31051  /**
31052  * \brief accept (or visit) the current AST node using provided visitor
31053  *
31054  * Instead of visiting children of AST node, like Ast::visit_children,
31055  * accept allows to visit the current node itself using provided concrete
31056  * visitor.
31057  *
31058  * \param v Concrete visitor that will be used to recursively visit node
31059  *
31060  * \sa Ast::accept for example.
31061  */
31062  void accept(visitor::Visitor& v) override;
31063 
31064  /**
31065  * \copydoc accept(visitor::Visitor&)
31066  */
31067  void accept(visitor::ConstVisitor& v) const override;
31068 
31069  /// \}
31070 
31071 
31072 
31073  private:
31074  /**
31075  * \brief Set this object as parent for all the children
31076  *
31077  * This should be called in every object (with children) constructor
31078  * to set parents. Since it is called only in the constructors it
31079  * should not be virtual to avoid ambiguities (issue #295).
31080  */
31081  void set_parent_in_children();
31082 };
31083 
31084 /** @} */ // end of ast_class
31085 
31086 
31087 } // namespace ast
31088 } // namespace nmodl
31089 #endif // !NMODL_AST_COMPARTMENT_HPP
31090 #ifndef NMODL_AST_LON_DIFUSE_HPP
31091 #define NMODL_AST_LON_DIFUSE_HPP
31092 
31093 
31094 namespace nmodl {
31095 namespace ast {
31096 
31097 /**
31098  * @addtogroup ast_class
31099  * @ingroup ast
31100  * @{
31101  */
31102 
31103 /**
31104  * \brief Represent LONGITUDINAL_DIFFUSION statement in NMODL
31105  *
31106  *
31107 */
31108 class LonDifuse : public Statement {
31109  private:
31110  /// TODO
31111  std::shared_ptr<Name> name;
31112  /// TODO
31113  std::shared_ptr<Expression> expression;
31114  /// TODO
31116  /// token with location information
31117  std::shared_ptr<ModToken> token;
31118 
31119  public:
31120 
31121  /// \name Ctor & dtor
31122  /// \{
31123 
31124  explicit LonDifuse(Name* name, Expression* expression, NameVector names);
31125  explicit LonDifuse(const std::shared_ptr<Name>& name, const std::shared_ptr<Expression>& expression, const NameVector& names);
31126  LonDifuse(const LonDifuse& obj);
31127 
31128 
31129  virtual ~LonDifuse() = default;
31130 
31131  /// \}
31132 
31133 
31134 
31135 
31136 
31137 
31138  /**
31139  * \brief Check if the ast node is an instance of ast::LonDifuse
31140  * \return true as object is of type ast::LonDifuse
31141  */
31142  bool is_lon_difuse () const noexcept override {
31143  return true;
31144  }
31145 
31146  /**
31147  * \brief Return a copy of the current node
31148  *
31149  * Recursively make a new copy/clone of the current node including
31150  * all members and return a pointer to the node. This is used for
31151  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31152  * ast.
31153  *
31154  * @return pointer to the clone/copy of the current node
31155  */
31156  LonDifuse* clone() const override {
31157  return new LonDifuse(*this);
31158  }
31159 
31160  /// \name Getters
31161  /// \{
31162 
31163  /**
31164  * \brief Return type (ast::AstNodeType) of ast node
31165  *
31166  * Every node in the ast has a type defined in ast::AstNodeType and this
31167  * function is used to retrieve the same.
31168  *
31169  * \return ast node type i.e. ast::AstNodeType::LON_DIFUSE
31170  *
31171  * \sa Ast::get_node_type_name
31172  */
31173  AstNodeType get_node_type() const noexcept override {
31174  return AstNodeType::LON_DIFUSE;
31175  }
31176 
31177  /**
31178  * \brief Return type (ast::AstNodeType) of ast node as std::string
31179  *
31180  * Every node in the ast has a type defined in ast::AstNodeType.
31181  * This type name can be returned as a std::string for printing
31182  * node to text/json form.
31183  *
31184  * \return name of the node type as a string i.e. "LonDifuse"
31185  *
31186  * \sa Ast::get_node_name
31187  */
31188  std::string get_node_type_name() const noexcept override {
31189  return "LonDifuse";
31190  }
31191 
31192  /**
31193  * \brief Return NMODL statement of ast node as std::string
31194  *
31195  * Every node is related to a special statement in the NMODL. This
31196  * statement can be returned as a std::string for printing to
31197  * text/json form.
31198  *
31199  * \return name of the statement as a string i.e. "LONGITUDINAL_DIFFUSION"
31200  *
31201  * \sa Ast::get_nmodl_name
31202  */
31203  std::string get_nmodl_name() const noexcept override {
31204  return "LONGITUDINAL_DIFFUSION";
31205  }
31206 
31207  /**
31208  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31209  */
31210  std::shared_ptr<Ast> get_shared_ptr() override {
31211  return std::static_pointer_cast<LonDifuse>(shared_from_this());
31212  }
31213 
31214  /**
31215  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31216  */
31217  std::shared_ptr<const Ast> get_shared_ptr() const override {
31218  return std::static_pointer_cast<const LonDifuse>(shared_from_this());
31219  }
31220 
31221  /**
31222  * \brief Return associated token for the current ast node
31223  *
31224  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
31225  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
31226  * nullptr to store in the nmodl::symtab::SymbolTable.
31227  *
31228  * \return pointer to token if exist otherwise nullptr
31229  */
31230  const ModToken* get_token() const noexcept override {
31231  return token.get();
31232  }
31233 
31234 
31235 
31236 
31237 
31238 
31239 
31240 
31241  /**
31242  * \brief Getter for member variable \ref LonDifuse.name
31243  */
31244  const std::shared_ptr<Name>& get_name() const noexcept {
31245  return name;
31246  }
31247 
31248 
31249 
31250 
31251 
31252 
31253 
31254  /**
31255  * \brief Getter for member variable \ref LonDifuse.expression
31256  */
31257  const std::shared_ptr<Expression>& get_expression() const noexcept {
31258  return expression;
31259  }
31260 
31261 
31262 
31263 
31264 
31265 
31266 
31267  /**
31268  * \brief Getter for member variable \ref LonDifuse.names
31269  */
31270  const NameVector& get_names() const noexcept {
31271  return names;
31272  }
31273 
31274 
31275 
31276  /// \}
31277 
31278  /// \name Setters
31279  /// \{
31280 
31281 
31282  /**
31283  * \brief Set token for the current ast node
31284  */
31285  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
31286 
31287 
31288 
31289 
31290  /**
31291  * \brief Setter for member variable \ref LonDifuse.name (rvalue reference)
31292  */
31293  void set_name(std::shared_ptr<Name>&& name);
31294 
31295  /**
31296  * \brief Setter for member variable \ref LonDifuse.name
31297  */
31298  void set_name(const std::shared_ptr<Name>& name);
31299 
31300 
31301  /**
31302  * \brief Setter for member variable \ref LonDifuse.expression (rvalue reference)
31303  */
31304  void set_expression(std::shared_ptr<Expression>&& expression);
31305 
31306  /**
31307  * \brief Setter for member variable \ref LonDifuse.expression
31308  */
31309  void set_expression(const std::shared_ptr<Expression>& expression);
31310 
31311 
31312  /**
31313  * \brief Setter for member variable \ref LonDifuse.names (rvalue reference)
31314  */
31315  void set_names(NameVector&& names);
31316 
31317  /**
31318  * \brief Setter for member variable \ref LonDifuse.names
31319  */
31320  void set_names(const NameVector& names);
31321 
31322 
31323  /// \}
31324 
31325  /// \name Visitor
31326  /// \{
31327 
31328  /**
31329  * \brief visit children i.e. member variables of current node using provided visitor
31330  *
31331  * Different nodes in the AST have different members (i.e. children). This method
31332  * recursively visits children using provided visitor.
31333  *
31334  * \param v Concrete visitor that will be used to recursively visit children
31335  *
31336  * \sa Ast::visit_children for example.
31337  */
31338  void visit_children(visitor::Visitor& v) override;
31339 
31340  /**
31341  * \brief visit children i.e. member variables of current node using provided visitor
31342  *
31343  * Different nodes in the AST have different members (i.e. children). This method
31344  * recursively visits children using provided visitor.
31345  *
31346  * \param v Concrete constant visitor that will be used to recursively visit children
31347  *
31348  * \sa Ast::visit_children for example.
31349  */
31350  void visit_children(visitor::ConstVisitor& v) const override;
31351 
31352  /**
31353  * \brief accept (or visit) the current AST node using provided visitor
31354  *
31355  * Instead of visiting children of AST node, like Ast::visit_children,
31356  * accept allows to visit the current node itself using provided concrete
31357  * visitor.
31358  *
31359  * \param v Concrete visitor that will be used to recursively visit node
31360  *
31361  * \sa Ast::accept for example.
31362  */
31363  void accept(visitor::Visitor& v) override;
31364 
31365  /**
31366  * \copydoc accept(visitor::Visitor&)
31367  */
31368  void accept(visitor::ConstVisitor& v) const override;
31369 
31370  /// \}
31371 
31372 
31373 
31374  private:
31375  /**
31376  * \brief Set this object as parent for all the children
31377  *
31378  * This should be called in every object (with children) constructor
31379  * to set parents. Since it is called only in the constructors it
31380  * should not be virtual to avoid ambiguities (issue #295).
31381  */
31382  void set_parent_in_children();
31383 };
31384 
31385 /** @} */ // end of ast_class
31386 
31387 
31388 } // namespace ast
31389 } // namespace nmodl
31390 #endif // !NMODL_AST_LON_DIFUSE_HPP
31391 #ifndef NMODL_AST_REACTION_STATEMENT_HPP
31392 #define NMODL_AST_REACTION_STATEMENT_HPP
31393 
31394 
31395 namespace nmodl {
31396 namespace ast {
31397 
31398 /**
31399  * @addtogroup ast_class
31400  * @ingroup ast
31401  * @{
31402  */
31403 
31404 /**
31405  * \brief TODO
31406  *
31407  *
31408 */
31410  private:
31411  /// TODO
31412  std::shared_ptr<Expression> reaction1;
31413  /// TODO
31415  /// TODO
31416  std::shared_ptr<Expression> reaction2;
31417  /// TODO
31418  std::shared_ptr<Expression> expression1;
31419  /// TODO
31420  std::shared_ptr<Expression> expression2;
31421  /// token with location information
31422  std::shared_ptr<ModToken> token;
31423 
31424  public:
31425 
31426  /// \name Ctor & dtor
31427  /// \{
31428 
31429  explicit ReactionStatement(Expression* reaction1, const ReactionOperator& op, Expression* reaction2, Expression* expression1, Expression* expression2);
31430  explicit ReactionStatement(const std::shared_ptr<Expression>& reaction1, const ReactionOperator& op, const std::shared_ptr<Expression>& reaction2, const std::shared_ptr<Expression>& expression1, const std::shared_ptr<Expression>& expression2);
31432 
31433 
31434  virtual ~ReactionStatement() = default;
31435 
31436  /// \}
31437 
31438 
31439 
31440 
31441 
31442 
31443  /**
31444  * \brief Check if the ast node is an instance of ast::ReactionStatement
31445  * \return true as object is of type ast::ReactionStatement
31446  */
31447  bool is_reaction_statement () const noexcept override {
31448  return true;
31449  }
31450 
31451  /**
31452  * \brief Return a copy of the current node
31453  *
31454  * Recursively make a new copy/clone of the current node including
31455  * all members and return a pointer to the node. This is used for
31456  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31457  * ast.
31458  *
31459  * @return pointer to the clone/copy of the current node
31460  */
31461  ReactionStatement* clone() const override {
31462  return new ReactionStatement(*this);
31463  }
31464 
31465  /// \name Getters
31466  /// \{
31467 
31468  /**
31469  * \brief Return type (ast::AstNodeType) of ast node
31470  *
31471  * Every node in the ast has a type defined in ast::AstNodeType and this
31472  * function is used to retrieve the same.
31473  *
31474  * \return ast node type i.e. ast::AstNodeType::REACTION_STATEMENT
31475  *
31476  * \sa Ast::get_node_type_name
31477  */
31478  AstNodeType get_node_type() const noexcept override {
31480  }
31481 
31482  /**
31483  * \brief Return type (ast::AstNodeType) of ast node as std::string
31484  *
31485  * Every node in the ast has a type defined in ast::AstNodeType.
31486  * This type name can be returned as a std::string for printing
31487  * node to text/json form.
31488  *
31489  * \return name of the node type as a string i.e. "ReactionStatement"
31490  *
31491  * \sa Ast::get_node_name
31492  */
31493  std::string get_node_type_name() const noexcept override {
31494  return "ReactionStatement";
31495  }
31496 
31497  /**
31498  * \brief Return NMODL statement of ast node as std::string
31499  *
31500  * Every node is related to a special statement in the NMODL. This
31501  * statement can be returned as a std::string for printing to
31502  * text/json form.
31503  *
31504  * \return name of the statement as a string i.e. "~ "
31505  *
31506  * \sa Ast::get_nmodl_name
31507  */
31508  std::string get_nmodl_name() const noexcept override {
31509  return "~ ";
31510  }
31511 
31512  /**
31513  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31514  */
31515  std::shared_ptr<Ast> get_shared_ptr() override {
31516  return std::static_pointer_cast<ReactionStatement>(shared_from_this());
31517  }
31518 
31519  /**
31520  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31521  */
31522  std::shared_ptr<const Ast> get_shared_ptr() const override {
31523  return std::static_pointer_cast<const ReactionStatement>(shared_from_this());
31524  }
31525 
31526  /**
31527  * \brief Return associated token for the current ast node
31528  *
31529  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
31530  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
31531  * nullptr to store in the nmodl::symtab::SymbolTable.
31532  *
31533  * \return pointer to token if exist otherwise nullptr
31534  */
31535  const ModToken* get_token() const noexcept override {
31536  return token.get();
31537  }
31538 
31539 
31540 
31541 
31542 
31543 
31544 
31545 
31546  /**
31547  * \brief Getter for member variable \ref ReactionStatement.reaction1
31548  */
31549  const std::shared_ptr<Expression>& get_reaction1() const noexcept {
31550  return reaction1;
31551  }
31552 
31553 
31554 
31555 
31556 
31557 
31558 
31559  /**
31560  * \brief Getter for member variable \ref ReactionStatement.op
31561  */
31562  const ReactionOperator& get_op() const noexcept {
31563  return op;
31564  }
31565 
31566 
31567 
31568 
31569 
31570 
31571 
31572  /**
31573  * \brief Getter for member variable \ref ReactionStatement.reaction2
31574  */
31575  const std::shared_ptr<Expression>& get_reaction2() const noexcept {
31576  return reaction2;
31577  }
31578 
31579 
31580 
31581 
31582 
31583 
31584 
31585  /**
31586  * \brief Getter for member variable \ref ReactionStatement.expression1
31587  */
31588  const std::shared_ptr<Expression>& get_expression1() const noexcept {
31589  return expression1;
31590  }
31591 
31592 
31593 
31594 
31595 
31596 
31597 
31598  /**
31599  * \brief Getter for member variable \ref ReactionStatement.expression2
31600  */
31601  const std::shared_ptr<Expression>& get_expression2() const noexcept {
31602  return expression2;
31603  }
31604 
31605 
31606 
31607  /// \}
31608 
31609  /// \name Setters
31610  /// \{
31611 
31612 
31613  /**
31614  * \brief Set token for the current ast node
31615  */
31616  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
31617 
31618 
31619 
31620 
31621  /**
31622  * \brief Setter for member variable \ref ReactionStatement.reaction1 (rvalue reference)
31623  */
31624  void set_reaction1(std::shared_ptr<Expression>&& reaction1);
31625 
31626  /**
31627  * \brief Setter for member variable \ref ReactionStatement.reaction1
31628  */
31629  void set_reaction1(const std::shared_ptr<Expression>& reaction1);
31630 
31631 
31632  /**
31633  * \brief Setter for member variable \ref ReactionStatement.op (rvalue reference)
31634  */
31635  void set_op(ReactionOperator&& op);
31636 
31637  /**
31638  * \brief Setter for member variable \ref ReactionStatement.op
31639  */
31640  void set_op(const ReactionOperator& op);
31641 
31642 
31643  /**
31644  * \brief Setter for member variable \ref ReactionStatement.reaction2 (rvalue reference)
31645  */
31646  void set_reaction2(std::shared_ptr<Expression>&& reaction2);
31647 
31648  /**
31649  * \brief Setter for member variable \ref ReactionStatement.reaction2
31650  */
31651  void set_reaction2(const std::shared_ptr<Expression>& reaction2);
31652 
31653 
31654  /**
31655  * \brief Setter for member variable \ref ReactionStatement.expression1 (rvalue reference)
31656  */
31657  void set_expression1(std::shared_ptr<Expression>&& expression1);
31658 
31659  /**
31660  * \brief Setter for member variable \ref ReactionStatement.expression1
31661  */
31662  void set_expression1(const std::shared_ptr<Expression>& expression1);
31663 
31664 
31665  /**
31666  * \brief Setter for member variable \ref ReactionStatement.expression2 (rvalue reference)
31667  */
31668  void set_expression2(std::shared_ptr<Expression>&& expression2);
31669 
31670  /**
31671  * \brief Setter for member variable \ref ReactionStatement.expression2
31672  */
31673  void set_expression2(const std::shared_ptr<Expression>& expression2);
31674 
31675 
31676  /// \}
31677 
31678  /// \name Visitor
31679  /// \{
31680 
31681  /**
31682  * \brief visit children i.e. member variables of current node using provided visitor
31683  *
31684  * Different nodes in the AST have different members (i.e. children). This method
31685  * recursively visits children using provided visitor.
31686  *
31687  * \param v Concrete visitor that will be used to recursively visit children
31688  *
31689  * \sa Ast::visit_children for example.
31690  */
31691  void visit_children(visitor::Visitor& v) override;
31692 
31693  /**
31694  * \brief visit children i.e. member variables of current node using provided visitor
31695  *
31696  * Different nodes in the AST have different members (i.e. children). This method
31697  * recursively visits children using provided visitor.
31698  *
31699  * \param v Concrete constant visitor that will be used to recursively visit children
31700  *
31701  * \sa Ast::visit_children for example.
31702  */
31703  void visit_children(visitor::ConstVisitor& v) const override;
31704 
31705  /**
31706  * \brief accept (or visit) the current AST node using provided visitor
31707  *
31708  * Instead of visiting children of AST node, like Ast::visit_children,
31709  * accept allows to visit the current node itself using provided concrete
31710  * visitor.
31711  *
31712  * \param v Concrete visitor that will be used to recursively visit node
31713  *
31714  * \sa Ast::accept for example.
31715  */
31716  void accept(visitor::Visitor& v) override;
31717 
31718  /**
31719  * \copydoc accept(visitor::Visitor&)
31720  */
31721  void accept(visitor::ConstVisitor& v) const override;
31722 
31723  /// \}
31724 
31725 
31726 
31727  private:
31728  /**
31729  * \brief Set this object as parent for all the children
31730  *
31731  * This should be called in every object (with children) constructor
31732  * to set parents. Since it is called only in the constructors it
31733  * should not be virtual to avoid ambiguities (issue #295).
31734  */
31735  void set_parent_in_children();
31736 };
31737 
31738 /** @} */ // end of ast_class
31739 
31740 
31741 } // namespace ast
31742 } // namespace nmodl
31743 #endif // !NMODL_AST_REACTION_STATEMENT_HPP
31744 #ifndef NMODL_AST_LAG_STATEMENT_HPP
31745 #define NMODL_AST_LAG_STATEMENT_HPP
31746 
31747 
31748 namespace nmodl {
31749 namespace ast {
31750 
31751 /**
31752  * @addtogroup ast_class
31753  * @ingroup ast
31754  * @{
31755  */
31756 
31757 /**
31758  * \brief Represents a LAG statement in the mod file
31759  *
31760  * An example of LAG statement usage:
31761  *
31762  * \code{.mod}
31763  * PROCEDURE lates() {
31764  * LAG ina BY tau
31765  * neo = lag_ina_tau
31766  * if (ena < 70) {ena = 70}
31767  * }
31768  * \endcode
31769  *
31770 */
31771 class LagStatement : public Statement {
31772  private:
31773  /// Name of the variable (TODO)
31774  std::shared_ptr<Identifier> name;
31775  /// Name of the variable (TODO)
31776  std::shared_ptr<Name> byname;
31777  /// token with location information
31778  std::shared_ptr<ModToken> token;
31779 
31780  public:
31781 
31782  /// \name Ctor & dtor
31783  /// \{
31784 
31785  explicit LagStatement(Identifier* name, Name* byname);
31786  explicit LagStatement(const std::shared_ptr<Identifier>& name, const std::shared_ptr<Name>& byname);
31787  LagStatement(const LagStatement& obj);
31788 
31789 
31790  virtual ~LagStatement() = default;
31791 
31792  /// \}
31793 
31794 
31795 
31796 
31797 
31798 
31799  /**
31800  * \brief Check if the ast node is an instance of ast::LagStatement
31801  * \return true as object is of type ast::LagStatement
31802  */
31803  bool is_lag_statement () const noexcept override {
31804  return true;
31805  }
31806 
31807  /**
31808  * \brief Return a copy of the current node
31809  *
31810  * Recursively make a new copy/clone of the current node including
31811  * all members and return a pointer to the node. This is used for
31812  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31813  * ast.
31814  *
31815  * @return pointer to the clone/copy of the current node
31816  */
31817  LagStatement* clone() const override {
31818  return new LagStatement(*this);
31819  }
31820 
31821  /// \name Getters
31822  /// \{
31823 
31824  /**
31825  * \brief Return type (ast::AstNodeType) of ast node
31826  *
31827  * Every node in the ast has a type defined in ast::AstNodeType and this
31828  * function is used to retrieve the same.
31829  *
31830  * \return ast node type i.e. ast::AstNodeType::LAG_STATEMENT
31831  *
31832  * \sa Ast::get_node_type_name
31833  */
31834  AstNodeType get_node_type() const noexcept override {
31836  }
31837 
31838  /**
31839  * \brief Return type (ast::AstNodeType) of ast node as std::string
31840  *
31841  * Every node in the ast has a type defined in ast::AstNodeType.
31842  * This type name can be returned as a std::string for printing
31843  * node to text/json form.
31844  *
31845  * \return name of the node type as a string i.e. "LagStatement"
31846  *
31847  * \sa Ast::get_node_name
31848  */
31849  std::string get_node_type_name() const noexcept override {
31850  return "LagStatement";
31851  }
31852 
31853  /**
31854  * \brief Return NMODL statement of ast node as std::string
31855  *
31856  * Every node is related to a special statement in the NMODL. This
31857  * statement can be returned as a std::string for printing to
31858  * text/json form.
31859  *
31860  * \return name of the statement as a string i.e. "LAG "
31861  *
31862  * \sa Ast::get_nmodl_name
31863  */
31864  std::string get_nmodl_name() const noexcept override {
31865  return "LAG ";
31866  }
31867 
31868  /**
31869  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31870  */
31871  std::shared_ptr<Ast> get_shared_ptr() override {
31872  return std::static_pointer_cast<LagStatement>(shared_from_this());
31873  }
31874 
31875  /**
31876  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31877  */
31878  std::shared_ptr<const Ast> get_shared_ptr() const override {
31879  return std::static_pointer_cast<const LagStatement>(shared_from_this());
31880  }
31881 
31882  /**
31883  * \brief Return associated token for the current ast node
31884  *
31885  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
31886  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
31887  * nullptr to store in the nmodl::symtab::SymbolTable.
31888  *
31889  * \return pointer to token if exist otherwise nullptr
31890  */
31891  const ModToken* get_token() const noexcept override {
31892  return token.get();
31893  }
31894 
31895 
31896 
31897 
31898 
31899 
31900 
31901 
31902  /**
31903  * \brief Getter for member variable \ref LagStatement.name
31904  */
31905  const std::shared_ptr<Identifier>& get_name() const noexcept {
31906  return name;
31907  }
31908 
31909 
31910 
31911 
31912 
31913 
31914 
31915  /**
31916  * \brief Getter for member variable \ref LagStatement.byname
31917  */
31918  const std::shared_ptr<Name>& get_byname() const noexcept {
31919  return byname;
31920  }
31921 
31922 
31923 
31924  /// \}
31925 
31926  /// \name Setters
31927  /// \{
31928 
31929 
31930  /**
31931  * \brief Set token for the current ast node
31932  */
31933  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
31934 
31935 
31936 
31937 
31938  /**
31939  * \brief Setter for member variable \ref LagStatement.name (rvalue reference)
31940  */
31941  void set_name(std::shared_ptr<Identifier>&& name);
31942 
31943  /**
31944  * \brief Setter for member variable \ref LagStatement.name
31945  */
31946  void set_name(const std::shared_ptr<Identifier>& name);
31947 
31948 
31949  /**
31950  * \brief Setter for member variable \ref LagStatement.byname (rvalue reference)
31951  */
31952  void set_byname(std::shared_ptr<Name>&& byname);
31953 
31954  /**
31955  * \brief Setter for member variable \ref LagStatement.byname
31956  */
31957  void set_byname(const std::shared_ptr<Name>& byname);
31958 
31959 
31960  /// \}
31961 
31962  /// \name Visitor
31963  /// \{
31964 
31965  /**
31966  * \brief visit children i.e. member variables of current node using provided visitor
31967  *
31968  * Different nodes in the AST have different members (i.e. children). This method
31969  * recursively visits children using provided visitor.
31970  *
31971  * \param v Concrete visitor that will be used to recursively visit children
31972  *
31973  * \sa Ast::visit_children for example.
31974  */
31975  void visit_children(visitor::Visitor& v) override;
31976 
31977  /**
31978  * \brief visit children i.e. member variables of current node using provided visitor
31979  *
31980  * Different nodes in the AST have different members (i.e. children). This method
31981  * recursively visits children using provided visitor.
31982  *
31983  * \param v Concrete constant visitor that will be used to recursively visit children
31984  *
31985  * \sa Ast::visit_children for example.
31986  */
31987  void visit_children(visitor::ConstVisitor& v) const override;
31988 
31989  /**
31990  * \brief accept (or visit) the current AST node using provided visitor
31991  *
31992  * Instead of visiting children of AST node, like Ast::visit_children,
31993  * accept allows to visit the current node itself using provided concrete
31994  * visitor.
31995  *
31996  * \param v Concrete visitor that will be used to recursively visit node
31997  *
31998  * \sa Ast::accept for example.
31999  */
32000  void accept(visitor::Visitor& v) override;
32001 
32002  /**
32003  * \copydoc accept(visitor::Visitor&)
32004  */
32005  void accept(visitor::ConstVisitor& v) const override;
32006 
32007  /// \}
32008 
32009 
32010 
32011  private:
32012  /**
32013  * \brief Set this object as parent for all the children
32014  *
32015  * This should be called in every object (with children) constructor
32016  * to set parents. Since it is called only in the constructors it
32017  * should not be virtual to avoid ambiguities (issue #295).
32018  */
32019  void set_parent_in_children();
32020 };
32021 
32022 /** @} */ // end of ast_class
32023 
32024 
32025 } // namespace ast
32026 } // namespace nmodl
32027 #endif // !NMODL_AST_LAG_STATEMENT_HPP
32028 #ifndef NMODL_AST_QUEUE_STATEMENT_HPP
32029 #define NMODL_AST_QUEUE_STATEMENT_HPP
32030 
32031 
32032 namespace nmodl {
32033 namespace ast {
32034 
32035 /**
32036  * @addtogroup ast_class
32037  * @ingroup ast
32038  * @{
32039  */
32040 
32041 /**
32042  * \brief Represent queue statement in NMODL
32043  *
32044  *
32045 */
32046 class QueueStatement : public Statement {
32047  private:
32048  /// queue type (put/get)
32049  std::shared_ptr<QueueExpressionType> qtype;
32050  /// Name of the variable
32051  std::shared_ptr<Identifier> name;
32052  /// token with location information
32053  std::shared_ptr<ModToken> token;
32054 
32055  public:
32056 
32057  /// \name Ctor & dtor
32058  /// \{
32059 
32060  explicit QueueStatement(QueueExpressionType* qtype, Identifier* name);
32061  explicit QueueStatement(const std::shared_ptr<QueueExpressionType>& qtype, const std::shared_ptr<Identifier>& name);
32062  QueueStatement(const QueueStatement& obj);
32063 
32064 
32065  virtual ~QueueStatement() = default;
32066 
32067  /// \}
32068 
32069 
32070 
32071 
32072 
32073 
32074  /**
32075  * \brief Check if the ast node is an instance of ast::QueueStatement
32076  * \return true as object is of type ast::QueueStatement
32077  */
32078  bool is_queue_statement () const noexcept override {
32079  return true;
32080  }
32081 
32082  /**
32083  * \brief Return a copy of the current node
32084  *
32085  * Recursively make a new copy/clone of the current node including
32086  * all members and return a pointer to the node. This is used for
32087  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32088  * ast.
32089  *
32090  * @return pointer to the clone/copy of the current node
32091  */
32092  QueueStatement* clone() const override {
32093  return new QueueStatement(*this);
32094  }
32095 
32096  /// \name Getters
32097  /// \{
32098 
32099  /**
32100  * \brief Return type (ast::AstNodeType) of ast node
32101  *
32102  * Every node in the ast has a type defined in ast::AstNodeType and this
32103  * function is used to retrieve the same.
32104  *
32105  * \return ast node type i.e. ast::AstNodeType::QUEUE_STATEMENT
32106  *
32107  * \sa Ast::get_node_type_name
32108  */
32109  AstNodeType get_node_type() const noexcept override {
32111  }
32112 
32113  /**
32114  * \brief Return type (ast::AstNodeType) of ast node as std::string
32115  *
32116  * Every node in the ast has a type defined in ast::AstNodeType.
32117  * This type name can be returned as a std::string for printing
32118  * node to text/json form.
32119  *
32120  * \return name of the node type as a string i.e. "QueueStatement"
32121  *
32122  * \sa Ast::get_node_name
32123  */
32124  std::string get_node_type_name() const noexcept override {
32125  return "QueueStatement";
32126  }
32127 
32128 
32129  /**
32130  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32131  */
32132  std::shared_ptr<Ast> get_shared_ptr() override {
32133  return std::static_pointer_cast<QueueStatement>(shared_from_this());
32134  }
32135 
32136  /**
32137  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32138  */
32139  std::shared_ptr<const Ast> get_shared_ptr() const override {
32140  return std::static_pointer_cast<const QueueStatement>(shared_from_this());
32141  }
32142 
32143  /**
32144  * \brief Return associated token for the current ast node
32145  *
32146  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
32147  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
32148  * nullptr to store in the nmodl::symtab::SymbolTable.
32149  *
32150  * \return pointer to token if exist otherwise nullptr
32151  */
32152  const ModToken* get_token() const noexcept override {
32153  return token.get();
32154  }
32155 
32156 
32157 
32158 
32159 
32160 
32161 
32162 
32163  /**
32164  * \brief Getter for member variable \ref QueueStatement.qtype
32165  */
32166  const std::shared_ptr<QueueExpressionType>& get_qtype() const noexcept {
32167  return qtype;
32168  }
32169 
32170 
32171 
32172 
32173 
32174 
32175 
32176  /**
32177  * \brief Getter for member variable \ref QueueStatement.name
32178  */
32179  const std::shared_ptr<Identifier>& get_name() const noexcept {
32180  return name;
32181  }
32182 
32183 
32184 
32185  /// \}
32186 
32187  /// \name Setters
32188  /// \{
32189 
32190 
32191  /**
32192  * \brief Set token for the current ast node
32193  */
32194  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
32195 
32196 
32197 
32198 
32199  /**
32200  * \brief Setter for member variable \ref QueueStatement.qtype (rvalue reference)
32201  */
32202  void set_qtype(std::shared_ptr<QueueExpressionType>&& qtype);
32203 
32204  /**
32205  * \brief Setter for member variable \ref QueueStatement.qtype
32206  */
32207  void set_qtype(const std::shared_ptr<QueueExpressionType>& qtype);
32208 
32209 
32210  /**
32211  * \brief Setter for member variable \ref QueueStatement.name (rvalue reference)
32212  */
32213  void set_name(std::shared_ptr<Identifier>&& name);
32214 
32215  /**
32216  * \brief Setter for member variable \ref QueueStatement.name
32217  */
32218  void set_name(const std::shared_ptr<Identifier>& name);
32219 
32220 
32221  /// \}
32222 
32223  /// \name Visitor
32224  /// \{
32225 
32226  /**
32227  * \brief visit children i.e. member variables of current node using provided visitor
32228  *
32229  * Different nodes in the AST have different members (i.e. children). This method
32230  * recursively visits children using provided visitor.
32231  *
32232  * \param v Concrete visitor that will be used to recursively visit children
32233  *
32234  * \sa Ast::visit_children for example.
32235  */
32236  void visit_children(visitor::Visitor& v) override;
32237 
32238  /**
32239  * \brief visit children i.e. member variables of current node using provided visitor
32240  *
32241  * Different nodes in the AST have different members (i.e. children). This method
32242  * recursively visits children using provided visitor.
32243  *
32244  * \param v Concrete constant visitor that will be used to recursively visit children
32245  *
32246  * \sa Ast::visit_children for example.
32247  */
32248  void visit_children(visitor::ConstVisitor& v) const override;
32249 
32250  /**
32251  * \brief accept (or visit) the current AST node using provided visitor
32252  *
32253  * Instead of visiting children of AST node, like Ast::visit_children,
32254  * accept allows to visit the current node itself using provided concrete
32255  * visitor.
32256  *
32257  * \param v Concrete visitor that will be used to recursively visit node
32258  *
32259  * \sa Ast::accept for example.
32260  */
32261  void accept(visitor::Visitor& v) override;
32262 
32263  /**
32264  * \copydoc accept(visitor::Visitor&)
32265  */
32266  void accept(visitor::ConstVisitor& v) const override;
32267 
32268  /// \}
32269 
32270 
32271 
32272  private:
32273  /**
32274  * \brief Set this object as parent for all the children
32275  *
32276  * This should be called in every object (with children) constructor
32277  * to set parents. Since it is called only in the constructors it
32278  * should not be virtual to avoid ambiguities (issue #295).
32279  */
32280  void set_parent_in_children();
32281 };
32282 
32283 /** @} */ // end of ast_class
32284 
32285 
32286 } // namespace ast
32287 } // namespace nmodl
32288 #endif // !NMODL_AST_QUEUE_STATEMENT_HPP
32289 #ifndef NMODL_AST_CONSTANT_STATEMENT_HPP
32290 #define NMODL_AST_CONSTANT_STATEMENT_HPP
32291 
32292 
32293 namespace nmodl {
32294 namespace ast {
32295 
32296 /**
32297  * @addtogroup ast_class
32298  * @ingroup ast
32299  * @{
32300  */
32301 
32302 /**
32303  * \brief Represent statement in CONSTANT block of NMODL
32304  *
32305  * \todo As ConstantStatement wraps a single ConstantVar,
32306  * this or ast::ConstantVar can be redundant in the future.
32307  *
32308 */
32310  private:
32311  /// single constant variable
32312  std::shared_ptr<ConstantVar> constant;
32313  /// token with location information
32314  std::shared_ptr<ModToken> token;
32315 
32316  public:
32317 
32318  /// \name Ctor & dtor
32319  /// \{
32320 
32321  explicit ConstantStatement(ConstantVar* constant);
32322  explicit ConstantStatement(const std::shared_ptr<ConstantVar>& constant);
32324 
32325 
32326  virtual ~ConstantStatement() = default;
32327 
32328  /// \}
32329 
32330 
32331 
32332 
32333 
32334 
32335  /**
32336  * \brief Check if the ast node is an instance of ast::ConstantStatement
32337  * \return true as object is of type ast::ConstantStatement
32338  */
32339  bool is_constant_statement () const noexcept override {
32340  return true;
32341  }
32342 
32343  /**
32344  * \brief Return a copy of the current node
32345  *
32346  * Recursively make a new copy/clone of the current node including
32347  * all members and return a pointer to the node. This is used for
32348  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32349  * ast.
32350  *
32351  * @return pointer to the clone/copy of the current node
32352  */
32353  ConstantStatement* clone() const override {
32354  return new ConstantStatement(*this);
32355  }
32356 
32357  /// \name Getters
32358  /// \{
32359 
32360  /**
32361  * \brief Return type (ast::AstNodeType) of ast node
32362  *
32363  * Every node in the ast has a type defined in ast::AstNodeType and this
32364  * function is used to retrieve the same.
32365  *
32366  * \return ast node type i.e. ast::AstNodeType::CONSTANT_STATEMENT
32367  *
32368  * \sa Ast::get_node_type_name
32369  */
32370  AstNodeType get_node_type() const noexcept override {
32372  }
32373 
32374  /**
32375  * \brief Return type (ast::AstNodeType) of ast node as std::string
32376  *
32377  * Every node in the ast has a type defined in ast::AstNodeType.
32378  * This type name can be returned as a std::string for printing
32379  * node to text/json form.
32380  *
32381  * \return name of the node type as a string i.e. "ConstantStatement"
32382  *
32383  * \sa Ast::get_node_name
32384  */
32385  std::string get_node_type_name() const noexcept override {
32386  return "ConstantStatement";
32387  }
32388 
32389 
32390  /**
32391  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32392  */
32393  std::shared_ptr<Ast> get_shared_ptr() override {
32394  return std::static_pointer_cast<ConstantStatement>(shared_from_this());
32395  }
32396 
32397  /**
32398  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32399  */
32400  std::shared_ptr<const Ast> get_shared_ptr() const override {
32401  return std::static_pointer_cast<const ConstantStatement>(shared_from_this());
32402  }
32403 
32404  /**
32405  * \brief Return associated token for the current ast node
32406  *
32407  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
32408  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
32409  * nullptr to store in the nmodl::symtab::SymbolTable.
32410  *
32411  * \return pointer to token if exist otherwise nullptr
32412  */
32413  const ModToken* get_token() const noexcept override {
32414  return token.get();
32415  }
32416 
32417 
32418 
32419 
32420 
32421 
32422 
32423 
32424  /**
32425  * \brief Getter for member variable \ref ConstantStatement.constant
32426  */
32427  const std::shared_ptr<ConstantVar>& get_constant() const noexcept {
32428  return constant;
32429  }
32430 
32431 
32432 
32433  /// \}
32434 
32435  /// \name Setters
32436  /// \{
32437 
32438 
32439  /**
32440  * \brief Set token for the current ast node
32441  */
32442  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
32443 
32444 
32445 
32446 
32447  /**
32448  * \brief Setter for member variable \ref ConstantStatement.constant (rvalue reference)
32449  */
32450  void set_constant(std::shared_ptr<ConstantVar>&& constant);
32451 
32452  /**
32453  * \brief Setter for member variable \ref ConstantStatement.constant
32454  */
32455  void set_constant(const std::shared_ptr<ConstantVar>& constant);
32456 
32457 
32458  /// \}
32459 
32460  /// \name Visitor
32461  /// \{
32462 
32463  /**
32464  * \brief visit children i.e. member variables of current node using provided visitor
32465  *
32466  * Different nodes in the AST have different members (i.e. children). This method
32467  * recursively visits children using provided visitor.
32468  *
32469  * \param v Concrete visitor that will be used to recursively visit children
32470  *
32471  * \sa Ast::visit_children for example.
32472  */
32473  void visit_children(visitor::Visitor& v) override;
32474 
32475  /**
32476  * \brief visit children i.e. member variables of current node using provided visitor
32477  *
32478  * Different nodes in the AST have different members (i.e. children). This method
32479  * recursively visits children using provided visitor.
32480  *
32481  * \param v Concrete constant visitor that will be used to recursively visit children
32482  *
32483  * \sa Ast::visit_children for example.
32484  */
32485  void visit_children(visitor::ConstVisitor& v) const override;
32486 
32487  /**
32488  * \brief accept (or visit) the current AST node using provided visitor
32489  *
32490  * Instead of visiting children of AST node, like Ast::visit_children,
32491  * accept allows to visit the current node itself using provided concrete
32492  * visitor.
32493  *
32494  * \param v Concrete visitor that will be used to recursively visit node
32495  *
32496  * \sa Ast::accept for example.
32497  */
32498  void accept(visitor::Visitor& v) override;
32499 
32500  /**
32501  * \copydoc accept(visitor::Visitor&)
32502  */
32503  void accept(visitor::ConstVisitor& v) const override;
32504 
32505  /// \}
32506 
32507 
32508 
32509  private:
32510  /**
32511  * \brief Set this object as parent for all the children
32512  *
32513  * This should be called in every object (with children) constructor
32514  * to set parents. Since it is called only in the constructors it
32515  * should not be virtual to avoid ambiguities (issue #295).
32516  */
32517  void set_parent_in_children();
32518 };
32519 
32520 /** @} */ // end of ast_class
32521 
32522 
32523 } // namespace ast
32524 } // namespace nmodl
32525 #endif // !NMODL_AST_CONSTANT_STATEMENT_HPP
32526 #ifndef NMODL_AST_TABLE_STATEMENT_HPP
32527 #define NMODL_AST_TABLE_STATEMENT_HPP
32528 
32529 
32530 namespace nmodl {
32531 namespace ast {
32532 
32533 /**
32534  * @addtogroup ast_class
32535  * @ingroup ast
32536  * @{
32537  */
32538 
32539 /**
32540  * \brief Represents TABLE statement in NMODL
32541  *
32542  *
32543 */
32544 class TableStatement : public Statement {
32545  private:
32546  /// Variables in the table
32548  /// dependent variables
32550  /// from value
32551  std::shared_ptr<Expression> from;
32552  /// to values
32553  std::shared_ptr<Expression> to;
32554  /// an increment factor
32555  std::shared_ptr<Integer> with;
32556  /// token with location information
32557  std::shared_ptr<ModToken> token;
32558 
32559  public:
32560 
32561  /// \name Ctor & dtor
32562  /// \{
32563 
32564  explicit TableStatement(NameVector table_vars, NameVector depend_vars, Expression* from, Expression* to, Integer* with);
32565  explicit TableStatement(const NameVector& table_vars, const NameVector& depend_vars, const std::shared_ptr<Expression>& from, const std::shared_ptr<Expression>& to, const std::shared_ptr<Integer>& with);
32566  TableStatement(const TableStatement& obj);
32567 
32568 
32569  virtual ~TableStatement() = default;
32570 
32571  /// \}
32572 
32573 
32574 
32575 
32576 
32577 
32578  /**
32579  * \brief Check if the ast node is an instance of ast::TableStatement
32580  * \return true as object is of type ast::TableStatement
32581  */
32582  bool is_table_statement () const noexcept override {
32583  return true;
32584  }
32585 
32586  /**
32587  * \brief Return a copy of the current node
32588  *
32589  * Recursively make a new copy/clone of the current node including
32590  * all members and return a pointer to the node. This is used for
32591  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32592  * ast.
32593  *
32594  * @return pointer to the clone/copy of the current node
32595  */
32596  TableStatement* clone() const override {
32597  return new TableStatement(*this);
32598  }
32599 
32600  /// \name Getters
32601  /// \{
32602 
32603  /**
32604  * \brief Return type (ast::AstNodeType) of ast node
32605  *
32606  * Every node in the ast has a type defined in ast::AstNodeType and this
32607  * function is used to retrieve the same.
32608  *
32609  * \return ast node type i.e. ast::AstNodeType::TABLE_STATEMENT
32610  *
32611  * \sa Ast::get_node_type_name
32612  */
32613  AstNodeType get_node_type() const noexcept override {
32615  }
32616 
32617  /**
32618  * \brief Return type (ast::AstNodeType) of ast node as std::string
32619  *
32620  * Every node in the ast has a type defined in ast::AstNodeType.
32621  * This type name can be returned as a std::string for printing
32622  * node to text/json form.
32623  *
32624  * \return name of the node type as a string i.e. "TableStatement"
32625  *
32626  * \sa Ast::get_node_name
32627  */
32628  std::string get_node_type_name() const noexcept override {
32629  return "TableStatement";
32630  }
32631 
32632  /**
32633  * \brief Return NMODL statement of ast node as std::string
32634  *
32635  * Every node is related to a special statement in the NMODL. This
32636  * statement can be returned as a std::string for printing to
32637  * text/json form.
32638  *
32639  * \return name of the statement as a string i.e. "TABLE "
32640  *
32641  * \sa Ast::get_nmodl_name
32642  */
32643  std::string get_nmodl_name() const noexcept override {
32644  return "TABLE ";
32645  }
32646 
32647  /**
32648  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32649  */
32650  std::shared_ptr<Ast> get_shared_ptr() override {
32651  return std::static_pointer_cast<TableStatement>(shared_from_this());
32652  }
32653 
32654  /**
32655  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32656  */
32657  std::shared_ptr<const Ast> get_shared_ptr() const override {
32658  return std::static_pointer_cast<const TableStatement>(shared_from_this());
32659  }
32660 
32661  /**
32662  * \brief Return associated token for the current ast node
32663  *
32664  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
32665  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
32666  * nullptr to store in the nmodl::symtab::SymbolTable.
32667  *
32668  * \return pointer to token if exist otherwise nullptr
32669  */
32670  const ModToken* get_token() const noexcept override {
32671  return token.get();
32672  }
32673 
32674 
32675 
32676 
32677 
32678 
32679 
32680 
32681  /**
32682  * \brief Getter for member variable \ref TableStatement.table_vars
32683  */
32684  const NameVector& get_table_vars() const noexcept {
32685  return table_vars;
32686  }
32687 
32688 
32689 
32690 
32691 
32692 
32693 
32694  /**
32695  * \brief Getter for member variable \ref TableStatement.depend_vars
32696  */
32697  const NameVector& get_depend_vars() const noexcept {
32698  return depend_vars;
32699  }
32700 
32701 
32702 
32703 
32704 
32705 
32706 
32707  /**
32708  * \brief Getter for member variable \ref TableStatement.from
32709  */
32710  const std::shared_ptr<Expression>& get_from() const noexcept {
32711  return from;
32712  }
32713 
32714 
32715 
32716 
32717 
32718 
32719 
32720  /**
32721  * \brief Getter for member variable \ref TableStatement.to
32722  */
32723  const std::shared_ptr<Expression>& get_to() const noexcept {
32724  return to;
32725  }
32726 
32727 
32728 
32729 
32730 
32731 
32732 
32733  /**
32734  * \brief Getter for member variable \ref TableStatement.with
32735  */
32736  const std::shared_ptr<Integer>& get_with() const noexcept {
32737  return with;
32738  }
32739 
32740 
32741 
32742  /// \}
32743 
32744  /// \name Setters
32745  /// \{
32746 
32747 
32748  /**
32749  * \brief Set token for the current ast node
32750  */
32751  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
32752 
32753 
32754 
32755 
32756  /**
32757  * \brief Setter for member variable \ref TableStatement.table_vars (rvalue reference)
32758  */
32759  void set_table_vars(NameVector&& table_vars);
32760 
32761  /**
32762  * \brief Setter for member variable \ref TableStatement.table_vars
32763  */
32764  void set_table_vars(const NameVector& table_vars);
32765 
32766 
32767  /**
32768  * \brief Setter for member variable \ref TableStatement.depend_vars (rvalue reference)
32769  */
32770  void set_depend_vars(NameVector&& depend_vars);
32771 
32772  /**
32773  * \brief Setter for member variable \ref TableStatement.depend_vars
32774  */
32775  void set_depend_vars(const NameVector& depend_vars);
32776 
32777 
32778  /**
32779  * \brief Setter for member variable \ref TableStatement.from (rvalue reference)
32780  */
32781  void set_from(std::shared_ptr<Expression>&& from);
32782 
32783  /**
32784  * \brief Setter for member variable \ref TableStatement.from
32785  */
32786  void set_from(const std::shared_ptr<Expression>& from);
32787 
32788 
32789  /**
32790  * \brief Setter for member variable \ref TableStatement.to (rvalue reference)
32791  */
32792  void set_to(std::shared_ptr<Expression>&& to);
32793 
32794  /**
32795  * \brief Setter for member variable \ref TableStatement.to
32796  */
32797  void set_to(const std::shared_ptr<Expression>& to);
32798 
32799 
32800  /**
32801  * \brief Setter for member variable \ref TableStatement.with (rvalue reference)
32802  */
32803  void set_with(std::shared_ptr<Integer>&& with);
32804 
32805  /**
32806  * \brief Setter for member variable \ref TableStatement.with
32807  */
32808  void set_with(const std::shared_ptr<Integer>& with);
32809 
32810 
32811  /// \}
32812 
32813  /// \name Visitor
32814  /// \{
32815 
32816  /**
32817  * \brief visit children i.e. member variables of current node using provided visitor
32818  *
32819  * Different nodes in the AST have different members (i.e. children). This method
32820  * recursively visits children using provided visitor.
32821  *
32822  * \param v Concrete visitor that will be used to recursively visit children
32823  *
32824  * \sa Ast::visit_children for example.
32825  */
32826  void visit_children(visitor::Visitor& v) override;
32827 
32828  /**
32829  * \brief visit children i.e. member variables of current node using provided visitor
32830  *
32831  * Different nodes in the AST have different members (i.e. children). This method
32832  * recursively visits children using provided visitor.
32833  *
32834  * \param v Concrete constant visitor that will be used to recursively visit children
32835  *
32836  * \sa Ast::visit_children for example.
32837  */
32838  void visit_children(visitor::ConstVisitor& v) const override;
32839 
32840  /**
32841  * \brief accept (or visit) the current AST node using provided visitor
32842  *
32843  * Instead of visiting children of AST node, like Ast::visit_children,
32844  * accept allows to visit the current node itself using provided concrete
32845  * visitor.
32846  *
32847  * \param v Concrete visitor that will be used to recursively visit node
32848  *
32849  * \sa Ast::accept for example.
32850  */
32851  void accept(visitor::Visitor& v) override;
32852 
32853  /**
32854  * \copydoc accept(visitor::Visitor&)
32855  */
32856  void accept(visitor::ConstVisitor& v) const override;
32857 
32858  /// \}
32859 
32860 
32861 
32862  private:
32863  /**
32864  * \brief Set this object as parent for all the children
32865  *
32866  * This should be called in every object (with children) constructor
32867  * to set parents. Since it is called only in the constructors it
32868  * should not be virtual to avoid ambiguities (issue #295).
32869  */
32870  void set_parent_in_children();
32871 };
32872 
32873 /** @} */ // end of ast_class
32874 
32875 
32876 } // namespace ast
32877 } // namespace nmodl
32878 #endif // !NMODL_AST_TABLE_STATEMENT_HPP
32879 #ifndef NMODL_AST_SUFFIX_HPP
32880 #define NMODL_AST_SUFFIX_HPP
32881 
32882 
32883 namespace nmodl {
32884 namespace ast {
32885 
32886 /**
32887  * @addtogroup ast_class
32888  * @ingroup ast
32889  * @{
32890  */
32891 
32892 /**
32893  * \brief Represents SUFFIX statement in NMODL
32894  *
32895  *
32896 */
32897 class Suffix : public Statement {
32898  private:
32899  /// type of channel
32900  std::shared_ptr<Name> type;
32901  /// Name of the channel
32902  std::shared_ptr<Name> name;
32903  /// token with location information
32904  std::shared_ptr<ModToken> token;
32905 
32906  public:
32907 
32908  /// \name Ctor & dtor
32909  /// \{
32910 
32911  explicit Suffix(Name* type, Name* name);
32912  explicit Suffix(const std::shared_ptr<Name>& type, const std::shared_ptr<Name>& name);
32913  Suffix(const Suffix& obj);
32914 
32915 
32916  virtual ~Suffix() = default;
32917 
32918  /// \}
32919 
32920 
32921 
32922 
32923 
32924 
32925  /**
32926  * \brief Check if the ast node is an instance of ast::Suffix
32927  * \return true as object is of type ast::Suffix
32928  */
32929  bool is_suffix () const noexcept override {
32930  return true;
32931  }
32932 
32933  /**
32934  * \brief Return a copy of the current node
32935  *
32936  * Recursively make a new copy/clone of the current node including
32937  * all members and return a pointer to the node. This is used for
32938  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32939  * ast.
32940  *
32941  * @return pointer to the clone/copy of the current node
32942  */
32943  Suffix* clone() const override {
32944  return new Suffix(*this);
32945  }
32946 
32947  /// \name Getters
32948  /// \{
32949 
32950  /**
32951  * \brief Return type (ast::AstNodeType) of ast node
32952  *
32953  * Every node in the ast has a type defined in ast::AstNodeType and this
32954  * function is used to retrieve the same.
32955  *
32956  * \return ast node type i.e. ast::AstNodeType::SUFFIX
32957  *
32958  * \sa Ast::get_node_type_name
32959  */
32960  AstNodeType get_node_type() const noexcept override {
32961  return AstNodeType::SUFFIX;
32962  }
32963 
32964  /**
32965  * \brief Return type (ast::AstNodeType) of ast node as std::string
32966  *
32967  * Every node in the ast has a type defined in ast::AstNodeType.
32968  * This type name can be returned as a std::string for printing
32969  * node to text/json form.
32970  *
32971  * \return name of the node type as a string i.e. "Suffix"
32972  *
32973  * \sa Ast::get_node_name
32974  */
32975  std::string get_node_type_name() const noexcept override {
32976  return "Suffix";
32977  }
32978 
32979 
32980  /**
32981  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32982  */
32983  std::shared_ptr<Ast> get_shared_ptr() override {
32984  return std::static_pointer_cast<Suffix>(shared_from_this());
32985  }
32986 
32987  /**
32988  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32989  */
32990  std::shared_ptr<const Ast> get_shared_ptr() const override {
32991  return std::static_pointer_cast<const Suffix>(shared_from_this());
32992  }
32993 
32994  /**
32995  * \brief Return associated token for the current ast node
32996  *
32997  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
32998  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
32999  * nullptr to store in the nmodl::symtab::SymbolTable.
33000  *
33001  * \return pointer to token if exist otherwise nullptr
33002  */
33003  const ModToken* get_token() const noexcept override {
33004  return token.get();
33005  }
33006 
33007 
33008 
33009 
33010 
33011 
33012 
33013 
33014  /**
33015  * \brief Getter for member variable \ref Suffix.type
33016  */
33017  const std::shared_ptr<Name>& get_type() const noexcept {
33018  return type;
33019  }
33020 
33021 
33022 
33023 
33024 
33025 /**
33026  * \brief Return name of the node
33027  *
33028  * Some ast nodes have a member marked designated as node name. For example,
33029  * in case of this ast::Name has name designated as a
33030  * node name.
33031  *
33032  * @return name of the node as std::string
33033  *
33034  * \sa Ast::get_node_type_name
33035  */
33036 std::string get_node_name() const override;
33037 
33038 
33039  /**
33040  * \brief Getter for member variable \ref Suffix.name
33041  */
33042  const std::shared_ptr<Name>& get_name() const noexcept {
33043  return name;
33044  }
33045 
33046 
33047 
33048  /// \}
33049 
33050  /// \name Setters
33051  /// \{
33052 
33053 
33054  /**
33055  * \brief Set token for the current ast node
33056  */
33057  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
33058 
33059 
33060 
33061 
33062  /**
33063  * \brief Setter for member variable \ref Suffix.type (rvalue reference)
33064  */
33065  void set_type(std::shared_ptr<Name>&& type);
33066 
33067  /**
33068  * \brief Setter for member variable \ref Suffix.type
33069  */
33070  void set_type(const std::shared_ptr<Name>& type);
33071 
33072 
33073  /**
33074  * \brief Setter for member variable \ref Suffix.name (rvalue reference)
33075  */
33076  void set_name(std::shared_ptr<Name>&& name);
33077 
33078  /**
33079  * \brief Setter for member variable \ref Suffix.name
33080  */
33081  void set_name(const std::shared_ptr<Name>& name);
33082 
33083 
33084  /// \}
33085 
33086  /// \name Visitor
33087  /// \{
33088 
33089  /**
33090  * \brief visit children i.e. member variables of current node using provided visitor
33091  *
33092  * Different nodes in the AST have different members (i.e. children). This method
33093  * recursively visits children using provided visitor.
33094  *
33095  * \param v Concrete visitor that will be used to recursively visit children
33096  *
33097  * \sa Ast::visit_children for example.
33098  */
33099  void visit_children(visitor::Visitor& v) override;
33100 
33101  /**
33102  * \brief visit children i.e. member variables of current node using provided visitor
33103  *
33104  * Different nodes in the AST have different members (i.e. children). This method
33105  * recursively visits children using provided visitor.
33106  *
33107  * \param v Concrete constant visitor that will be used to recursively visit children
33108  *
33109  * \sa Ast::visit_children for example.
33110  */
33111  void visit_children(visitor::ConstVisitor& v) const override;
33112 
33113  /**
33114  * \brief accept (or visit) the current AST node using provided visitor
33115  *
33116  * Instead of visiting children of AST node, like Ast::visit_children,
33117  * accept allows to visit the current node itself using provided concrete
33118  * visitor.
33119  *
33120  * \param v Concrete visitor that will be used to recursively visit node
33121  *
33122  * \sa Ast::accept for example.
33123  */
33124  void accept(visitor::Visitor& v) override;
33125 
33126  /**
33127  * \copydoc accept(visitor::Visitor&)
33128  */
33129  void accept(visitor::ConstVisitor& v) const override;
33130 
33131  /// \}
33132 
33133 
33134 
33135  private:
33136  /**
33137  * \brief Set this object as parent for all the children
33138  *
33139  * This should be called in every object (with children) constructor
33140  * to set parents. Since it is called only in the constructors it
33141  * should not be virtual to avoid ambiguities (issue #295).
33142  */
33143  void set_parent_in_children();
33144 };
33145 
33146 /** @} */ // end of ast_class
33147 
33148 
33149 } // namespace ast
33150 } // namespace nmodl
33151 #endif // !NMODL_AST_SUFFIX_HPP
33152 #ifndef NMODL_AST_USEION_HPP
33153 #define NMODL_AST_USEION_HPP
33154 
33155 
33156 namespace nmodl {
33157 namespace ast {
33158 
33159 /**
33160  * @addtogroup ast_class
33161  * @ingroup ast
33162  * @{
33163  */
33164 
33165 /**
33166  * \brief Represents USEION statement in NMODL
33167  *
33168  *
33169 */
33170 class Useion : public Statement {
33171  private:
33172  /// Name of ion
33173  std::shared_ptr<Name> name;
33174  /// Variables being read
33176  /// Variables being written
33178  /// (TODO)
33179  std::shared_ptr<Valence> valence;
33180  /// Ontology to indicate the chemical ion
33181  std::shared_ptr<String> ontology_id;
33182  /// token with location information
33183  std::shared_ptr<ModToken> token;
33184 
33185  public:
33186 
33187  /// \name Ctor & dtor
33188  /// \{
33189 
33190  explicit Useion(Name* name, ReadIonVarVector readlist, WriteIonVarVector writelist, Valence* valence, String* ontology_id);
33191  explicit Useion(const std::shared_ptr<Name>& name, const ReadIonVarVector& readlist, const WriteIonVarVector& writelist, const std::shared_ptr<Valence>& valence, const std::shared_ptr<String>& ontology_id);
33192  Useion(const Useion& obj);
33193 
33194 
33195  virtual ~Useion() = default;
33196 
33197  /// \}
33198 
33199 
33200 
33201 
33202 
33203 
33204  /**
33205  * \brief Check if the ast node is an instance of ast::Useion
33206  * \return true as object is of type ast::Useion
33207  */
33208  bool is_useion () const noexcept override {
33209  return true;
33210  }
33211 
33212  /**
33213  * \brief Return a copy of the current node
33214  *
33215  * Recursively make a new copy/clone of the current node including
33216  * all members and return a pointer to the node. This is used for
33217  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
33218  * ast.
33219  *
33220  * @return pointer to the clone/copy of the current node
33221  */
33222  Useion* clone() const override {
33223  return new Useion(*this);
33224  }
33225 
33226  /// \name Getters
33227  /// \{
33228 
33229  /**
33230  * \brief Return type (ast::AstNodeType) of ast node
33231  *
33232  * Every node in the ast has a type defined in ast::AstNodeType and this
33233  * function is used to retrieve the same.
33234  *
33235  * \return ast node type i.e. ast::AstNodeType::USEION
33236  *
33237  * \sa Ast::get_node_type_name
33238  */
33239  AstNodeType get_node_type() const noexcept override {
33240  return AstNodeType::USEION;
33241  }
33242 
33243  /**
33244  * \brief Return type (ast::AstNodeType) of ast node as std::string
33245  *
33246  * Every node in the ast has a type defined in ast::AstNodeType.
33247  * This type name can be returned as a std::string for printing
33248  * node to text/json form.
33249  *
33250  * \return name of the node type as a string i.e. "Useion"
33251  *
33252  * \sa Ast::get_node_name
33253  */
33254  std::string get_node_type_name() const noexcept override {
33255  return "Useion";
33256  }
33257 
33258  /**
33259  * \brief Return NMODL statement of ast node as std::string
33260  *
33261  * Every node is related to a special statement in the NMODL. This
33262  * statement can be returned as a std::string for printing to
33263  * text/json form.
33264  *
33265  * \return name of the statement as a string i.e. "USEION "
33266  *
33267  * \sa Ast::get_nmodl_name
33268  */
33269  std::string get_nmodl_name() const noexcept override {
33270  return "USEION ";
33271  }
33272 
33273  /**
33274  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33275  */
33276  std::shared_ptr<Ast> get_shared_ptr() override {
33277  return std::static_pointer_cast<Useion>(shared_from_this());
33278  }
33279 
33280  /**
33281  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33282  */
33283  std::shared_ptr<const Ast> get_shared_ptr() const override {
33284  return std::static_pointer_cast<const Useion>(shared_from_this());
33285  }
33286 
33287  /**
33288  * \brief Return associated token for the current ast node
33289  *
33290  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
33291  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
33292  * nullptr to store in the nmodl::symtab::SymbolTable.
33293  *
33294  * \return pointer to token if exist otherwise nullptr
33295  */
33296  const ModToken* get_token() const noexcept override {
33297  return token.get();
33298  }
33299 
33300 
33301 
33302 
33303 
33304 
33305 /**
33306  * \brief Return name of the node
33307  *
33308  * Some ast nodes have a member marked designated as node name. For example,
33309  * in case of this ast::Name has name designated as a
33310  * node name.
33311  *
33312  * @return name of the node as std::string
33313  *
33314  * \sa Ast::get_node_type_name
33315  */
33316 std::string get_node_name() const override;
33317 
33318 
33319  /**
33320  * \brief Getter for member variable \ref Useion.name
33321  */
33322  const std::shared_ptr<Name>& get_name() const noexcept {
33323  return name;
33324  }
33325 
33326 
33327 
33328 
33329 
33330 
33331 
33332  /**
33333  * \brief Getter for member variable \ref Useion.readlist
33334  */
33335  const ReadIonVarVector& get_readlist() const noexcept {
33336  return readlist;
33337  }
33338 
33339 
33340 
33341 
33342 
33343 
33344 
33345  /**
33346  * \brief Getter for member variable \ref Useion.writelist
33347  */
33348  const WriteIonVarVector& get_writelist() const noexcept {
33349  return writelist;
33350  }
33351 
33352 
33353 
33354 
33355 
33356 
33357 
33358  /**
33359  * \brief Getter for member variable \ref Useion.valence
33360  */
33361  const std::shared_ptr<Valence>& get_valence() const noexcept {
33362  return valence;
33363  }
33364 
33365 
33366 
33367 
33368 
33369 
33370 
33371  /**
33372  * \brief Getter for member variable \ref Useion.ontology_id
33373  */
33374  const std::shared_ptr<String>& get_ontology_id() const noexcept {
33375  return ontology_id;
33376  }
33377 
33378 
33379 
33380  /// \}
33381 
33382  /// \name Setters
33383  /// \{
33384 
33385 
33386  /**
33387  * \brief Set token for the current ast node
33388  */
33389  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
33390 
33391 
33392 
33393 
33394  /**
33395  * \brief Setter for member variable \ref Useion.name (rvalue reference)
33396  */
33397  void set_name(std::shared_ptr<Name>&& name);
33398 
33399  /**
33400  * \brief Setter for member variable \ref Useion.name
33401  */
33402  void set_name(const std::shared_ptr<Name>& name);
33403 
33404 
33405  /**
33406  * \brief Setter for member variable \ref Useion.readlist (rvalue reference)
33407  */
33408  void set_readlist(ReadIonVarVector&& readlist);
33409 
33410  /**
33411  * \brief Setter for member variable \ref Useion.readlist
33412  */
33413  void set_readlist(const ReadIonVarVector& readlist);
33414 
33415 
33416  /**
33417  * \brief Setter for member variable \ref Useion.writelist (rvalue reference)
33418  */
33419  void set_writelist(WriteIonVarVector&& writelist);
33420 
33421  /**
33422  * \brief Setter for member variable \ref Useion.writelist
33423  */
33424  void set_writelist(const WriteIonVarVector& writelist);
33425 
33426 
33427  /**
33428  * \brief Setter for member variable \ref Useion.valence (rvalue reference)
33429  */
33430  void set_valence(std::shared_ptr<Valence>&& valence);
33431 
33432  /**
33433  * \brief Setter for member variable \ref Useion.valence
33434  */
33435  void set_valence(const std::shared_ptr<Valence>& valence);
33436 
33437 
33438  /**
33439  * \brief Setter for member variable \ref Useion.ontology_id (rvalue reference)
33440  */
33441  void set_ontology_id(std::shared_ptr<String>&& ontology_id);
33442 
33443  /**
33444  * \brief Setter for member variable \ref Useion.ontology_id
33445  */
33446  void set_ontology_id(const std::shared_ptr<String>& ontology_id);
33447 
33448 
33449  /// \}
33450 
33451  /// \name Visitor
33452  /// \{
33453 
33454  /**
33455  * \brief visit children i.e. member variables of current node using provided visitor
33456  *
33457  * Different nodes in the AST have different members (i.e. children). This method
33458  * recursively visits children using provided visitor.
33459  *
33460  * \param v Concrete visitor that will be used to recursively visit children
33461  *
33462  * \sa Ast::visit_children for example.
33463  */
33464  void visit_children(visitor::Visitor& v) override;
33465 
33466  /**
33467  * \brief visit children i.e. member variables of current node using provided visitor
33468  *
33469  * Different nodes in the AST have different members (i.e. children). This method
33470  * recursively visits children using provided visitor.
33471  *
33472  * \param v Concrete constant visitor that will be used to recursively visit children
33473  *
33474  * \sa Ast::visit_children for example.
33475  */
33476  void visit_children(visitor::ConstVisitor& v) const override;
33477 
33478  /**
33479  * \brief accept (or visit) the current AST node using provided visitor
33480  *
33481  * Instead of visiting children of AST node, like Ast::visit_children,
33482  * accept allows to visit the current node itself using provided concrete
33483  * visitor.
33484  *
33485  * \param v Concrete visitor that will be used to recursively visit node
33486  *
33487  * \sa Ast::accept for example.
33488  */
33489  void accept(visitor::Visitor& v) override;
33490 
33491  /**
33492  * \copydoc accept(visitor::Visitor&)
33493  */
33494  void accept(visitor::ConstVisitor& v) const override;
33495 
33496  /// \}
33497 
33498 
33499 
33500  private:
33501  /**
33502  * \brief Set this object as parent for all the children
33503  *
33504  * This should be called in every object (with children) constructor
33505  * to set parents. Since it is called only in the constructors it
33506  * should not be virtual to avoid ambiguities (issue #295).
33507  */
33508  void set_parent_in_children();
33509 };
33510 
33511 /** @} */ // end of ast_class
33512 
33513 
33514 } // namespace ast
33515 } // namespace nmodl
33516 #endif // !NMODL_AST_USEION_HPP
33517 #ifndef NMODL_AST_NONSPECIFIC_HPP
33518 #define NMODL_AST_NONSPECIFIC_HPP
33519 
33520 
33521 namespace nmodl {
33522 namespace ast {
33523 
33524 /**
33525  * @addtogroup ast_class
33526  * @ingroup ast
33527  * @{
33528  */
33529 
33530 /**
33531  * \brief Represents NONSPECIFIC_CURRENT variables statement in NMODL
33532  *
33533  *
33534 */
33535 class Nonspecific : public Statement {
33536  private:
33537  /// Vector of non specific variables
33539  /// token with location information
33540  std::shared_ptr<ModToken> token;
33541 
33542  public:
33543 
33544  /// \name Ctor & dtor
33545  /// \{
33546 
33547  explicit Nonspecific(NonspecificCurVarVector currents);
33548  Nonspecific(const Nonspecific& obj);
33549 
33550 
33551  virtual ~Nonspecific() = default;
33552 
33553  /// \}
33554 
33555 
33556 
33557 
33558 
33559 
33560  /**
33561  * \brief Check if the ast node is an instance of ast::Nonspecific
33562  * \return true as object is of type ast::Nonspecific
33563  */
33564  bool is_nonspecific () const noexcept override {
33565  return true;
33566  }
33567 
33568  /**
33569  * \brief Return a copy of the current node
33570  *
33571  * Recursively make a new copy/clone of the current node including
33572  * all members and return a pointer to the node. This is used for
33573  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
33574  * ast.
33575  *
33576  * @return pointer to the clone/copy of the current node
33577  */
33578  Nonspecific* clone() const override {
33579  return new Nonspecific(*this);
33580  }
33581 
33582  /// \name Getters
33583  /// \{
33584 
33585  /**
33586  * \brief Return type (ast::AstNodeType) of ast node
33587  *
33588  * Every node in the ast has a type defined in ast::AstNodeType and this
33589  * function is used to retrieve the same.
33590  *
33591  * \return ast node type i.e. ast::AstNodeType::NONSPECIFIC
33592  *
33593  * \sa Ast::get_node_type_name
33594  */
33595  AstNodeType get_node_type() const noexcept override {
33596  return AstNodeType::NONSPECIFIC;
33597  }
33598 
33599  /**
33600  * \brief Return type (ast::AstNodeType) of ast node as std::string
33601  *
33602  * Every node in the ast has a type defined in ast::AstNodeType.
33603  * This type name can be returned as a std::string for printing
33604  * node to text/json form.
33605  *
33606  * \return name of the node type as a string i.e. "Nonspecific"
33607  *
33608  * \sa Ast::get_node_name
33609  */
33610  std::string get_node_type_name() const noexcept override {
33611  return "Nonspecific";
33612  }
33613 
33614  /**
33615  * \brief Return NMODL statement of ast node as std::string
33616  *
33617  * Every node is related to a special statement in the NMODL. This
33618  * statement can be returned as a std::string for printing to
33619  * text/json form.
33620  *
33621  * \return name of the statement as a string i.e. "NONSPECIFIC_CURRENT "
33622  *
33623  * \sa Ast::get_nmodl_name
33624  */
33625  std::string get_nmodl_name() const noexcept override {
33626  return "NONSPECIFIC_CURRENT ";
33627  }
33628 
33629  /**
33630  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33631  */
33632  std::shared_ptr<Ast> get_shared_ptr() override {
33633  return std::static_pointer_cast<Nonspecific>(shared_from_this());
33634  }
33635 
33636  /**
33637  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33638  */
33639  std::shared_ptr<const Ast> get_shared_ptr() const override {
33640  return std::static_pointer_cast<const Nonspecific>(shared_from_this());
33641  }
33642 
33643  /**
33644  * \brief Return associated token for the current ast node
33645  *
33646  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
33647  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
33648  * nullptr to store in the nmodl::symtab::SymbolTable.
33649  *
33650  * \return pointer to token if exist otherwise nullptr
33651  */
33652  const ModToken* get_token() const noexcept override {
33653  return token.get();
33654  }
33655 
33656 
33657 
33658 
33659 
33660 
33661 
33662 
33663  /**
33664  * \brief Getter for member variable \ref Nonspecific.currents
33665  */
33666  const NonspecificCurVarVector& get_currents() const noexcept {
33667  return currents;
33668  }
33669 
33670 
33671 
33672  /// \}
33673 
33674  /// \name Setters
33675  /// \{
33676 
33677 
33678  /**
33679  * \brief Set token for the current ast node
33680  */
33681  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
33682 
33683 
33684 
33685 
33686  /**
33687  * \brief Setter for member variable \ref Nonspecific.currents (rvalue reference)
33688  */
33689  void set_currents(NonspecificCurVarVector&& currents);
33690 
33691  /**
33692  * \brief Setter for member variable \ref Nonspecific.currents
33693  */
33694  void set_currents(const NonspecificCurVarVector& currents);
33695 
33696 
33697  /// \}
33698 
33699  /// \name Visitor
33700  /// \{
33701 
33702  /**
33703  * \brief visit children i.e. member variables of current node using provided visitor
33704  *
33705  * Different nodes in the AST have different members (i.e. children). This method
33706  * recursively visits children using provided visitor.
33707  *
33708  * \param v Concrete visitor that will be used to recursively visit children
33709  *
33710  * \sa Ast::visit_children for example.
33711  */
33712  void visit_children(visitor::Visitor& v) override;
33713 
33714  /**
33715  * \brief visit children i.e. member variables of current node using provided visitor
33716  *
33717  * Different nodes in the AST have different members (i.e. children). This method
33718  * recursively visits children using provided visitor.
33719  *
33720  * \param v Concrete constant visitor that will be used to recursively visit children
33721  *
33722  * \sa Ast::visit_children for example.
33723  */
33724  void visit_children(visitor::ConstVisitor& v) const override;
33725 
33726  /**
33727  * \brief accept (or visit) the current AST node using provided visitor
33728  *
33729  * Instead of visiting children of AST node, like Ast::visit_children,
33730  * accept allows to visit the current node itself using provided concrete
33731  * visitor.
33732  *
33733  * \param v Concrete visitor that will be used to recursively visit node
33734  *
33735  * \sa Ast::accept for example.
33736  */
33737  void accept(visitor::Visitor& v) override;
33738 
33739  /**
33740  * \copydoc accept(visitor::Visitor&)
33741  */
33742  void accept(visitor::ConstVisitor& v) const override;
33743 
33744  /// \}
33745 
33746 
33747 
33748  private:
33749  /**
33750  * \brief Set this object as parent for all the children
33751  *
33752  * This should be called in every object (with children) constructor
33753  * to set parents. Since it is called only in the constructors it
33754  * should not be virtual to avoid ambiguities (issue #295).
33755  */
33756  void set_parent_in_children();
33757 };
33758 
33759 /** @} */ // end of ast_class
33760 
33761 
33762 } // namespace ast
33763 } // namespace nmodl
33764 #endif // !NMODL_AST_NONSPECIFIC_HPP
33765 #ifndef NMODL_AST_ELECTRODE_CURRENT_HPP
33766 #define NMODL_AST_ELECTRODE_CURRENT_HPP
33767 
33768 
33769 namespace nmodl {
33770 namespace ast {
33771 
33772 /**
33773  * @addtogroup ast_class
33774  * @ingroup ast
33775  * @{
33776  */
33777 
33778 /**
33779  * \brief Represents ELECTRODE_CURRENT variables statement in NMODL
33780  *
33781  *
33782 */
33783 class ElectrodeCurrent : public Statement {
33784  private:
33785  /// Vector of electrode current variables
33787  /// token with location information
33788  std::shared_ptr<ModToken> token;
33789 
33790  public:
33791 
33792  /// \name Ctor & dtor
33793  /// \{
33794 
33795  explicit ElectrodeCurrent(ElectrodeCurVarVector currents);
33796  ElectrodeCurrent(const ElectrodeCurrent& obj);
33797 
33798 
33799  virtual ~ElectrodeCurrent() = default;
33800 
33801  /// \}
33802 
33803 
33804 
33805 
33806 
33807 
33808  /**
33809  * \brief Check if the ast node is an instance of ast::ElectrodeCurrent
33810  * \return true as object is of type ast::ElectrodeCurrent
33811  */
33812  bool is_electrode_current () const noexcept override {
33813  return true;
33814  }
33815 
33816  /**
33817  * \brief Return a copy of the current node
33818  *
33819  * Recursively make a new copy/clone of the current node including
33820  * all members and return a pointer to the node. This is used for
33821  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
33822  * ast.
33823  *
33824  * @return pointer to the clone/copy of the current node
33825  */
33826  ElectrodeCurrent* clone() const override {
33827  return new ElectrodeCurrent(*this);
33828  }
33829 
33830  /// \name Getters
33831  /// \{
33832 
33833  /**
33834  * \brief Return type (ast::AstNodeType) of ast node
33835  *
33836  * Every node in the ast has a type defined in ast::AstNodeType and this
33837  * function is used to retrieve the same.
33838  *
33839  * \return ast node type i.e. ast::AstNodeType::ELECTRODE_CURRENT
33840  *
33841  * \sa Ast::get_node_type_name
33842  */
33843  AstNodeType get_node_type() const noexcept override {
33845  }
33846 
33847  /**
33848  * \brief Return type (ast::AstNodeType) of ast node as std::string
33849  *
33850  * Every node in the ast has a type defined in ast::AstNodeType.
33851  * This type name can be returned as a std::string for printing
33852  * node to text/json form.
33853  *
33854  * \return name of the node type as a string i.e. "ElectrodeCurrent"
33855  *
33856  * \sa Ast::get_node_name
33857  */
33858  std::string get_node_type_name() const noexcept override {
33859  return "ElectrodeCurrent";
33860  }
33861 
33862  /**
33863  * \brief Return NMODL statement of ast node as std::string
33864  *
33865  * Every node is related to a special statement in the NMODL. This
33866  * statement can be returned as a std::string for printing to
33867  * text/json form.
33868  *
33869  * \return name of the statement as a string i.e. "ELECTRODE_CURRENT "
33870  *
33871  * \sa Ast::get_nmodl_name
33872  */
33873  std::string get_nmodl_name() const noexcept override {
33874  return "ELECTRODE_CURRENT ";
33875  }
33876 
33877  /**
33878  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33879  */
33880  std::shared_ptr<Ast> get_shared_ptr() override {
33881  return std::static_pointer_cast<ElectrodeCurrent>(shared_from_this());
33882  }
33883 
33884  /**
33885  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33886  */
33887  std::shared_ptr<const Ast> get_shared_ptr() const override {
33888  return std::static_pointer_cast<const ElectrodeCurrent>(shared_from_this());
33889  }
33890 
33891  /**
33892  * \brief Return associated token for the current ast node
33893  *
33894  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
33895  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
33896  * nullptr to store in the nmodl::symtab::SymbolTable.
33897  *
33898  * \return pointer to token if exist otherwise nullptr
33899  */
33900  const ModToken* get_token() const noexcept override {
33901  return token.get();
33902  }
33903 
33904 
33905 
33906 
33907 
33908 
33909 
33910 
33911  /**
33912  * \brief Getter for member variable \ref ElectrodeCurrent.currents
33913  */
33914  const ElectrodeCurVarVector& get_currents() const noexcept {
33915  return currents;
33916  }
33917 
33918 
33919 
33920  /// \}
33921 
33922  /// \name Setters
33923  /// \{
33924 
33925 
33926  /**
33927  * \brief Set token for the current ast node
33928  */
33929  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
33930 
33931 
33932 
33933 
33934  /**
33935  * \brief Setter for member variable \ref ElectrodeCurrent.currents (rvalue reference)
33936  */
33937  void set_currents(ElectrodeCurVarVector&& currents);
33938 
33939  /**
33940  * \brief Setter for member variable \ref ElectrodeCurrent.currents
33941  */
33942  void set_currents(const ElectrodeCurVarVector& currents);
33943 
33944 
33945  /// \}
33946 
33947  /// \name Visitor
33948  /// \{
33949 
33950  /**
33951  * \brief visit children i.e. member variables of current node using provided visitor
33952  *
33953  * Different nodes in the AST have different members (i.e. children). This method
33954  * recursively visits children using provided visitor.
33955  *
33956  * \param v Concrete visitor that will be used to recursively visit children
33957  *
33958  * \sa Ast::visit_children for example.
33959  */
33960  void visit_children(visitor::Visitor& v) override;
33961 
33962  /**
33963  * \brief visit children i.e. member variables of current node using provided visitor
33964  *
33965  * Different nodes in the AST have different members (i.e. children). This method
33966  * recursively visits children using provided visitor.
33967  *
33968  * \param v Concrete constant visitor that will be used to recursively visit children
33969  *
33970  * \sa Ast::visit_children for example.
33971  */
33972  void visit_children(visitor::ConstVisitor& v) const override;
33973 
33974  /**
33975  * \brief accept (or visit) the current AST node using provided visitor
33976  *
33977  * Instead of visiting children of AST node, like Ast::visit_children,
33978  * accept allows to visit the current node itself using provided concrete
33979  * visitor.
33980  *
33981  * \param v Concrete visitor that will be used to recursively visit node
33982  *
33983  * \sa Ast::accept for example.
33984  */
33985  void accept(visitor::Visitor& v) override;
33986 
33987  /**
33988  * \copydoc accept(visitor::Visitor&)
33989  */
33990  void accept(visitor::ConstVisitor& v) const override;
33991 
33992  /// \}
33993 
33994 
33995 
33996  private:
33997  /**
33998  * \brief Set this object as parent for all the children
33999  *
34000  * This should be called in every object (with children) constructor
34001  * to set parents. Since it is called only in the constructors it
34002  * should not be virtual to avoid ambiguities (issue #295).
34003  */
34004  void set_parent_in_children();
34005 };
34006 
34007 /** @} */ // end of ast_class
34008 
34009 
34010 } // namespace ast
34011 } // namespace nmodl
34012 #endif // !NMODL_AST_ELECTRODE_CURRENT_HPP
34013 #ifndef NMODL_AST_SECTION_HPP
34014 #define NMODL_AST_SECTION_HPP
34015 
34016 
34017 namespace nmodl {
34018 namespace ast {
34019 
34020 /**
34021  * @addtogroup ast_class
34022  * @ingroup ast
34023  * @{
34024  */
34025 
34026 /**
34027  * \brief Represents SECTION variables statement in NMODL
34028  *
34029  *
34030 */
34031 class Section : public Statement {
34032  private:
34033  /// Vector of section variables
34035  /// token with location information
34036  std::shared_ptr<ModToken> token;
34037 
34038  public:
34039 
34040  /// \name Ctor & dtor
34041  /// \{
34042 
34043  explicit Section(SectionVarVector sections);
34044  Section(const Section& obj);
34045 
34046 
34047  virtual ~Section() = default;
34048 
34049  /// \}
34050 
34051 
34052 
34053 
34054 
34055 
34056  /**
34057  * \brief Check if the ast node is an instance of ast::Section
34058  * \return true as object is of type ast::Section
34059  */
34060  bool is_section () const noexcept override {
34061  return true;
34062  }
34063 
34064  /**
34065  * \brief Return a copy of the current node
34066  *
34067  * Recursively make a new copy/clone of the current node including
34068  * all members and return a pointer to the node. This is used for
34069  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
34070  * ast.
34071  *
34072  * @return pointer to the clone/copy of the current node
34073  */
34074  Section* clone() const override {
34075  return new Section(*this);
34076  }
34077 
34078  /// \name Getters
34079  /// \{
34080 
34081  /**
34082  * \brief Return type (ast::AstNodeType) of ast node
34083  *
34084  * Every node in the ast has a type defined in ast::AstNodeType and this
34085  * function is used to retrieve the same.
34086  *
34087  * \return ast node type i.e. ast::AstNodeType::SECTION
34088  *
34089  * \sa Ast::get_node_type_name
34090  */
34091  AstNodeType get_node_type() const noexcept override {
34092  return AstNodeType::SECTION;
34093  }
34094 
34095  /**
34096  * \brief Return type (ast::AstNodeType) of ast node as std::string
34097  *
34098  * Every node in the ast has a type defined in ast::AstNodeType.
34099  * This type name can be returned as a std::string for printing
34100  * node to text/json form.
34101  *
34102  * \return name of the node type as a string i.e. "Section"
34103  *
34104  * \sa Ast::get_node_name
34105  */
34106  std::string get_node_type_name() const noexcept override {
34107  return "Section";
34108  }
34109 
34110  /**
34111  * \brief Return NMODL statement of ast node as std::string
34112  *
34113  * Every node is related to a special statement in the NMODL. This
34114  * statement can be returned as a std::string for printing to
34115  * text/json form.
34116  *
34117  * \return name of the statement as a string i.e. "SECTION "
34118  *
34119  * \sa Ast::get_nmodl_name
34120  */
34121  std::string get_nmodl_name() const noexcept override {
34122  return "SECTION ";
34123  }
34124 
34125  /**
34126  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34127  */
34128  std::shared_ptr<Ast> get_shared_ptr() override {
34129  return std::static_pointer_cast<Section>(shared_from_this());
34130  }
34131 
34132  /**
34133  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34134  */
34135  std::shared_ptr<const Ast> get_shared_ptr() const override {
34136  return std::static_pointer_cast<const Section>(shared_from_this());
34137  }
34138 
34139  /**
34140  * \brief Return associated token for the current ast node
34141  *
34142  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
34143  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
34144  * nullptr to store in the nmodl::symtab::SymbolTable.
34145  *
34146  * \return pointer to token if exist otherwise nullptr
34147  */
34148  const ModToken* get_token() const noexcept override {
34149  return token.get();
34150  }
34151 
34152 
34153 
34154 
34155 
34156 
34157 
34158 
34159  /**
34160  * \brief Getter for member variable \ref Section.sections
34161  */
34162  const SectionVarVector& get_sections() const noexcept {
34163  return sections;
34164  }
34165 
34166 
34167 
34168  /// \}
34169 
34170  /// \name Setters
34171  /// \{
34172 
34173 
34174  /**
34175  * \brief Set token for the current ast node
34176  */
34177  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
34178 
34179 
34180 
34181 
34182  /**
34183  * \brief Setter for member variable \ref Section.sections (rvalue reference)
34184  */
34185  void set_sections(SectionVarVector&& sections);
34186 
34187  /**
34188  * \brief Setter for member variable \ref Section.sections
34189  */
34190  void set_sections(const SectionVarVector& sections);
34191 
34192 
34193  /// \}
34194 
34195  /// \name Visitor
34196  /// \{
34197 
34198  /**
34199  * \brief visit children i.e. member variables of current node using provided visitor
34200  *
34201  * Different nodes in the AST have different members (i.e. children). This method
34202  * recursively visits children using provided visitor.
34203  *
34204  * \param v Concrete visitor that will be used to recursively visit children
34205  *
34206  * \sa Ast::visit_children for example.
34207  */
34208  void visit_children(visitor::Visitor& v) override;
34209 
34210  /**
34211  * \brief visit children i.e. member variables of current node using provided visitor
34212  *
34213  * Different nodes in the AST have different members (i.e. children). This method
34214  * recursively visits children using provided visitor.
34215  *
34216  * \param v Concrete constant visitor that will be used to recursively visit children
34217  *
34218  * \sa Ast::visit_children for example.
34219  */
34220  void visit_children(visitor::ConstVisitor& v) const override;
34221 
34222  /**
34223  * \brief accept (or visit) the current AST node using provided visitor
34224  *
34225  * Instead of visiting children of AST node, like Ast::visit_children,
34226  * accept allows to visit the current node itself using provided concrete
34227  * visitor.
34228  *
34229  * \param v Concrete visitor that will be used to recursively visit node
34230  *
34231  * \sa Ast::accept for example.
34232  */
34233  void accept(visitor::Visitor& v) override;
34234 
34235  /**
34236  * \copydoc accept(visitor::Visitor&)
34237  */
34238  void accept(visitor::ConstVisitor& v) const override;
34239 
34240  /// \}
34241 
34242 
34243 
34244  private:
34245  /**
34246  * \brief Set this object as parent for all the children
34247  *
34248  * This should be called in every object (with children) constructor
34249  * to set parents. Since it is called only in the constructors it
34250  * should not be virtual to avoid ambiguities (issue #295).
34251  */
34252  void set_parent_in_children();
34253 };
34254 
34255 /** @} */ // end of ast_class
34256 
34257 
34258 } // namespace ast
34259 } // namespace nmodl
34260 #endif // !NMODL_AST_SECTION_HPP
34261 #ifndef NMODL_AST_RANGE_HPP
34262 #define NMODL_AST_RANGE_HPP
34263 
34264 
34265 namespace nmodl {
34266 namespace ast {
34267 
34268 /**
34269  * @addtogroup ast_class
34270  * @ingroup ast
34271  * @{
34272  */
34273 
34274 /**
34275  * \brief Represents RANGE variables statement in NMODL
34276  *
34277  *
34278 */
34279 class Range : public Statement {
34280  private:
34281  /// Vector of range variables
34283  /// token with location information
34284  std::shared_ptr<ModToken> token;
34285 
34286  public:
34287 
34288  /// \name Ctor & dtor
34289  /// \{
34290 
34291  explicit Range(RangeVarVector variables);
34292  Range(const Range& obj);
34293 
34294 
34295  virtual ~Range() = default;
34296 
34297  /// \}
34298 
34299 
34300 
34301 
34302 
34303 
34304  /**
34305  * \brief Check if the ast node is an instance of ast::Range
34306  * \return true as object is of type ast::Range
34307  */
34308  bool is_range () const noexcept override {
34309  return true;
34310  }
34311 
34312  /**
34313  * \brief Return a copy of the current node
34314  *
34315  * Recursively make a new copy/clone of the current node including
34316  * all members and return a pointer to the node. This is used for
34317  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
34318  * ast.
34319  *
34320  * @return pointer to the clone/copy of the current node
34321  */
34322  Range* clone() const override {
34323  return new Range(*this);
34324  }
34325 
34326  /// \name Getters
34327  /// \{
34328 
34329  /**
34330  * \brief Return type (ast::AstNodeType) of ast node
34331  *
34332  * Every node in the ast has a type defined in ast::AstNodeType and this
34333  * function is used to retrieve the same.
34334  *
34335  * \return ast node type i.e. ast::AstNodeType::RANGE
34336  *
34337  * \sa Ast::get_node_type_name
34338  */
34339  AstNodeType get_node_type() const noexcept override {
34340  return AstNodeType::RANGE;
34341  }
34342 
34343  /**
34344  * \brief Return type (ast::AstNodeType) of ast node as std::string
34345  *
34346  * Every node in the ast has a type defined in ast::AstNodeType.
34347  * This type name can be returned as a std::string for printing
34348  * node to text/json form.
34349  *
34350  * \return name of the node type as a string i.e. "Range"
34351  *
34352  * \sa Ast::get_node_name
34353  */
34354  std::string get_node_type_name() const noexcept override {
34355  return "Range";
34356  }
34357 
34358  /**
34359  * \brief Return NMODL statement of ast node as std::string
34360  *
34361  * Every node is related to a special statement in the NMODL. This
34362  * statement can be returned as a std::string for printing to
34363  * text/json form.
34364  *
34365  * \return name of the statement as a string i.e. "RANGE "
34366  *
34367  * \sa Ast::get_nmodl_name
34368  */
34369  std::string get_nmodl_name() const noexcept override {
34370  return "RANGE ";
34371  }
34372 
34373  /**
34374  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34375  */
34376  std::shared_ptr<Ast> get_shared_ptr() override {
34377  return std::static_pointer_cast<Range>(shared_from_this());
34378  }
34379 
34380  /**
34381  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34382  */
34383  std::shared_ptr<const Ast> get_shared_ptr() const override {
34384  return std::static_pointer_cast<const Range>(shared_from_this());
34385  }
34386 
34387  /**
34388  * \brief Return associated token for the current ast node
34389  *
34390  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
34391  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
34392  * nullptr to store in the nmodl::symtab::SymbolTable.
34393  *
34394  * \return pointer to token if exist otherwise nullptr
34395  */
34396  const ModToken* get_token() const noexcept override {
34397  return token.get();
34398  }
34399 
34400 
34401 
34402 
34403 
34404 
34405 
34406 
34407  /**
34408  * \brief Getter for member variable \ref Range.variables
34409  */
34410  const RangeVarVector& get_variables() const noexcept {
34411  return variables;
34412  }
34413 
34414 
34415 
34416  /// \}
34417 
34418  /// \name Setters
34419  /// \{
34420 
34421 
34422  /**
34423  * \brief Set token for the current ast node
34424  */
34425  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
34426 
34427 
34428 
34429 
34430  /**
34431  * \brief Setter for member variable \ref Range.variables (rvalue reference)
34432  */
34433  void set_variables(RangeVarVector&& variables);
34434 
34435  /**
34436  * \brief Setter for member variable \ref Range.variables
34437  */
34438  void set_variables(const RangeVarVector& variables);
34439 
34440 
34441  /// \}
34442 
34443  /// \name Visitor
34444  /// \{
34445 
34446  /**
34447  * \brief visit children i.e. member variables of current node using provided visitor
34448  *
34449  * Different nodes in the AST have different members (i.e. children). This method
34450  * recursively visits children using provided visitor.
34451  *
34452  * \param v Concrete visitor that will be used to recursively visit children
34453  *
34454  * \sa Ast::visit_children for example.
34455  */
34456  void visit_children(visitor::Visitor& v) override;
34457 
34458  /**
34459  * \brief visit children i.e. member variables of current node using provided visitor
34460  *
34461  * Different nodes in the AST have different members (i.e. children). This method
34462  * recursively visits children using provided visitor.
34463  *
34464  * \param v Concrete constant visitor that will be used to recursively visit children
34465  *
34466  * \sa Ast::visit_children for example.
34467  */
34468  void visit_children(visitor::ConstVisitor& v) const override;
34469 
34470  /**
34471  * \brief accept (or visit) the current AST node using provided visitor
34472  *
34473  * Instead of visiting children of AST node, like Ast::visit_children,
34474  * accept allows to visit the current node itself using provided concrete
34475  * visitor.
34476  *
34477  * \param v Concrete visitor that will be used to recursively visit node
34478  *
34479  * \sa Ast::accept for example.
34480  */
34481  void accept(visitor::Visitor& v) override;
34482 
34483  /**
34484  * \copydoc accept(visitor::Visitor&)
34485  */
34486  void accept(visitor::ConstVisitor& v) const override;
34487 
34488  /// \}
34489 
34490 
34491 
34492  private:
34493  /**
34494  * \brief Set this object as parent for all the children
34495  *
34496  * This should be called in every object (with children) constructor
34497  * to set parents. Since it is called only in the constructors it
34498  * should not be virtual to avoid ambiguities (issue #295).
34499  */
34500  void set_parent_in_children();
34501 };
34502 
34503 /** @} */ // end of ast_class
34504 
34505 
34506 } // namespace ast
34507 } // namespace nmodl
34508 #endif // !NMODL_AST_RANGE_HPP
34509 #ifndef NMODL_AST_GLOBAL_HPP
34510 #define NMODL_AST_GLOBAL_HPP
34511 #define NMODL_AST_GLOBAL_HPP_INLINE_DEFINITION_REQUIRED
34512 
34513 
34514 namespace nmodl {
34515 namespace ast {
34516 
34517 /**
34518  * @addtogroup ast_class
34519  * @ingroup ast
34520  * @{
34521  */
34522 
34523 /**
34524  * \brief Represents GLOBAL statement in NMODL
34525  *
34526  *
34527 */
34528 class Global : public Statement {
34529  private:
34530  /// Vector of global variables
34532  /// token with location information
34533  std::shared_ptr<ModToken> token;
34534 
34535  public:
34536 
34537  /// \name Ctor & dtor
34538  /// \{
34539 
34540  explicit Global(GlobalVarVector variables);
34541  Global(const Global& obj);
34542 
34543 
34544  virtual ~Global() = default;
34545 
34546  /// \}
34547 
34548 
34549 
34550 
34551 
34552 
34553  /**
34554  * \brief Check if the ast node is an instance of ast::Global
34555  * \return true as object is of type ast::Global
34556  */
34557  bool is_global () const noexcept override {
34558  return true;
34559  }
34560 
34561  /**
34562  * \brief Return a copy of the current node
34563  *
34564  * Recursively make a new copy/clone of the current node including
34565  * all members and return a pointer to the node. This is used for
34566  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
34567  * ast.
34568  *
34569  * @return pointer to the clone/copy of the current node
34570  */
34571  Global* clone() const override {
34572  return new Global(*this);
34573  }
34574 
34575  /// \name Getters
34576  /// \{
34577 
34578  /**
34579  * \brief Return type (ast::AstNodeType) of ast node
34580  *
34581  * Every node in the ast has a type defined in ast::AstNodeType and this
34582  * function is used to retrieve the same.
34583  *
34584  * \return ast node type i.e. ast::AstNodeType::GLOBAL
34585  *
34586  * \sa Ast::get_node_type_name
34587  */
34588  AstNodeType get_node_type() const noexcept override {
34589  return AstNodeType::GLOBAL;
34590  }
34591 
34592  /**
34593  * \brief Return type (ast::AstNodeType) of ast node as std::string
34594  *
34595  * Every node in the ast has a type defined in ast::AstNodeType.
34596  * This type name can be returned as a std::string for printing
34597  * node to text/json form.
34598  *
34599  * \return name of the node type as a string i.e. "Global"
34600  *
34601  * \sa Ast::get_node_name
34602  */
34603  std::string get_node_type_name() const noexcept override {
34604  return "Global";
34605  }
34606 
34607  /**
34608  * \brief Return NMODL statement of ast node as std::string
34609  *
34610  * Every node is related to a special statement in the NMODL. This
34611  * statement can be returned as a std::string for printing to
34612  * text/json form.
34613  *
34614  * \return name of the statement as a string i.e. "GLOBAL "
34615  *
34616  * \sa Ast::get_nmodl_name
34617  */
34618  std::string get_nmodl_name() const noexcept override {
34619  return "GLOBAL ";
34620  }
34621 
34622  /**
34623  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34624  */
34625  std::shared_ptr<Ast> get_shared_ptr() override {
34626  return std::static_pointer_cast<Global>(shared_from_this());
34627  }
34628 
34629  /**
34630  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34631  */
34632  std::shared_ptr<const Ast> get_shared_ptr() const override {
34633  return std::static_pointer_cast<const Global>(shared_from_this());
34634  }
34635 
34636  /**
34637  * \brief Return associated token for the current ast node
34638  *
34639  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
34640  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
34641  * nullptr to store in the nmodl::symtab::SymbolTable.
34642  *
34643  * \return pointer to token if exist otherwise nullptr
34644  */
34645  const ModToken* get_token() const noexcept override {
34646  return token.get();
34647  }
34648 
34649 
34650 
34651 
34652 /**
34653  * \brief Add member to variables by raw pointer
34654  */
34655 void emplace_back_global_var(GlobalVar *n);
34656 
34657 /**
34658  * \brief Add member to variables by shared_ptr
34659  */
34660 void emplace_back_global_var(std::shared_ptr<GlobalVar> n);
34661 
34662 /**
34663  * \brief Erase member to variables
34664  */
34665 GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first);
34666 
34667 /**
34668  * \brief Erase members to variables
34669  */
34670 GlobalVarVector::const_iterator erase_global_var(GlobalVarVector::const_iterator first, GlobalVarVector::const_iterator last);
34671 
34672 /**
34673  * \brief Erase non-consecutive members to variables
34674  *
34675  * loosely following the cpp reference of remove_if
34676  */
34677 size_t erase_global_var(std::unordered_set<GlobalVar*>& to_be_erased);
34678 
34679 /**
34680  * \brief Insert member to variables
34681  */
34682 GlobalVarVector::const_iterator insert_global_var(GlobalVarVector::const_iterator position, const std::shared_ptr<GlobalVar>& n);
34683 
34684 /**
34685  * \brief Insert members to variables
34686  */
34687 template <class NodeType, class InputIterator>
34688 void insert_global_var(GlobalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last);
34689 
34690 /**
34691  * \brief Reset member to variables
34692  */
34693 void reset_global_var(GlobalVarVector::const_iterator position, GlobalVar* n);
34694 
34695 /**
34696  * \brief Reset member to variables
34697  */
34698 void reset_global_var(GlobalVarVector::const_iterator position, std::shared_ptr<GlobalVar> n);
34699 
34700 
34701 
34702 
34703 
34704  /**
34705  * \brief Getter for member variable \ref Global.variables
34706  */
34707  const GlobalVarVector& get_variables() const noexcept {
34708  return variables;
34709  }
34710 
34711 
34712 
34713  /// \}
34714 
34715  /// \name Setters
34716  /// \{
34717 
34718 
34719  /**
34720  * \brief Set token for the current ast node
34721  */
34722  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
34723 
34724 
34725 
34726 
34727  /**
34728  * \brief Setter for member variable \ref Global.variables (rvalue reference)
34729  */
34730  void set_variables(GlobalVarVector&& variables);
34731 
34732  /**
34733  * \brief Setter for member variable \ref Global.variables
34734  */
34735  void set_variables(const GlobalVarVector& variables);
34736 
34737 
34738  /// \}
34739 
34740  /// \name Visitor
34741  /// \{
34742 
34743  /**
34744  * \brief visit children i.e. member variables of current node using provided visitor
34745  *
34746  * Different nodes in the AST have different members (i.e. children). This method
34747  * recursively visits children using provided visitor.
34748  *
34749  * \param v Concrete visitor that will be used to recursively visit children
34750  *
34751  * \sa Ast::visit_children for example.
34752  */
34753  void visit_children(visitor::Visitor& v) override;
34754 
34755  /**
34756  * \brief visit children i.e. member variables of current node using provided visitor
34757  *
34758  * Different nodes in the AST have different members (i.e. children). This method
34759  * recursively visits children using provided visitor.
34760  *
34761  * \param v Concrete constant visitor that will be used to recursively visit children
34762  *
34763  * \sa Ast::visit_children for example.
34764  */
34765  void visit_children(visitor::ConstVisitor& v) const override;
34766 
34767  /**
34768  * \brief accept (or visit) the current AST node using provided visitor
34769  *
34770  * Instead of visiting children of AST node, like Ast::visit_children,
34771  * accept allows to visit the current node itself using provided concrete
34772  * visitor.
34773  *
34774  * \param v Concrete visitor that will be used to recursively visit node
34775  *
34776  * \sa Ast::accept for example.
34777  */
34778  void accept(visitor::Visitor& v) override;
34779 
34780  /**
34781  * \copydoc accept(visitor::Visitor&)
34782  */
34783  void accept(visitor::ConstVisitor& v) const override;
34784 
34785  /// \}
34786 
34787 
34788 
34789  private:
34790  /**
34791  * \brief Set this object as parent for all the children
34792  *
34793  * This should be called in every object (with children) constructor
34794  * to set parents. Since it is called only in the constructors it
34795  * should not be virtual to avoid ambiguities (issue #295).
34796  */
34797  void set_parent_in_children();
34798 };
34799 
34800 /** @} */ // end of ast_class
34801 
34802 
34803 } // namespace ast
34804 } // namespace nmodl
34805 #endif // !NMODL_AST_GLOBAL_HPP
34806 #ifndef NMODL_AST_POINTER_HPP
34807 #define NMODL_AST_POINTER_HPP
34808 
34809 
34810 namespace nmodl {
34811 namespace ast {
34812 
34813 /**
34814  * @addtogroup ast_class
34815  * @ingroup ast
34816  * @{
34817  */
34818 
34819 /**
34820  * \brief Represents POINTER statement in NMODL
34821  *
34822  *
34823 */
34824 class Pointer : public Statement {
34825  private:
34826  /// Vector of pointer variables
34828  /// token with location information
34829  std::shared_ptr<ModToken> token;
34830 
34831  public:
34832 
34833  /// \name Ctor & dtor
34834  /// \{
34835 
34836  explicit Pointer(PointerVarVector variables);
34837  Pointer(const Pointer& obj);
34838 
34839 
34840  virtual ~Pointer() = default;
34841 
34842  /// \}
34843 
34844 
34845 
34846 
34847 
34848 
34849  /**
34850  * \brief Check if the ast node is an instance of ast::Pointer
34851  * \return true as object is of type ast::Pointer
34852  */
34853  bool is_pointer () const noexcept override {
34854  return true;
34855  }
34856 
34857  /**
34858  * \brief Return a copy of the current node
34859  *
34860  * Recursively make a new copy/clone of the current node including
34861  * all members and return a pointer to the node. This is used for
34862  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
34863  * ast.
34864  *
34865  * @return pointer to the clone/copy of the current node
34866  */
34867  Pointer* clone() const override {
34868  return new Pointer(*this);
34869  }
34870 
34871  /// \name Getters
34872  /// \{
34873 
34874  /**
34875  * \brief Return type (ast::AstNodeType) of ast node
34876  *
34877  * Every node in the ast has a type defined in ast::AstNodeType and this
34878  * function is used to retrieve the same.
34879  *
34880  * \return ast node type i.e. ast::AstNodeType::POINTER
34881  *
34882  * \sa Ast::get_node_type_name
34883  */
34884  AstNodeType get_node_type() const noexcept override {
34885  return AstNodeType::POINTER;
34886  }
34887 
34888  /**
34889  * \brief Return type (ast::AstNodeType) of ast node as std::string
34890  *
34891  * Every node in the ast has a type defined in ast::AstNodeType.
34892  * This type name can be returned as a std::string for printing
34893  * node to text/json form.
34894  *
34895  * \return name of the node type as a string i.e. "Pointer"
34896  *
34897  * \sa Ast::get_node_name
34898  */
34899  std::string get_node_type_name() const noexcept override {
34900  return "Pointer";
34901  }
34902 
34903  /**
34904  * \brief Return NMODL statement of ast node as std::string
34905  *
34906  * Every node is related to a special statement in the NMODL. This
34907  * statement can be returned as a std::string for printing to
34908  * text/json form.
34909  *
34910  * \return name of the statement as a string i.e. "POINTER "
34911  *
34912  * \sa Ast::get_nmodl_name
34913  */
34914  std::string get_nmodl_name() const noexcept override {
34915  return "POINTER ";
34916  }
34917 
34918  /**
34919  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34920  */
34921  std::shared_ptr<Ast> get_shared_ptr() override {
34922  return std::static_pointer_cast<Pointer>(shared_from_this());
34923  }
34924 
34925  /**
34926  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34927  */
34928  std::shared_ptr<const Ast> get_shared_ptr() const override {
34929  return std::static_pointer_cast<const Pointer>(shared_from_this());
34930  }
34931 
34932  /**
34933  * \brief Return associated token for the current ast node
34934  *
34935  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
34936  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
34937  * nullptr to store in the nmodl::symtab::SymbolTable.
34938  *
34939  * \return pointer to token if exist otherwise nullptr
34940  */
34941  const ModToken* get_token() const noexcept override {
34942  return token.get();
34943  }
34944 
34945 
34946 
34947 
34948 
34949 
34950 
34951 
34952  /**
34953  * \brief Getter for member variable \ref Pointer.variables
34954  */
34955  const PointerVarVector& get_variables() const noexcept {
34956  return variables;
34957  }
34958 
34959 
34960 
34961  /// \}
34962 
34963  /// \name Setters
34964  /// \{
34965 
34966 
34967  /**
34968  * \brief Set token for the current ast node
34969  */
34970  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
34971 
34972 
34973 
34974 
34975  /**
34976  * \brief Setter for member variable \ref Pointer.variables (rvalue reference)
34977  */
34978  void set_variables(PointerVarVector&& variables);
34979 
34980  /**
34981  * \brief Setter for member variable \ref Pointer.variables
34982  */
34983  void set_variables(const PointerVarVector& variables);
34984 
34985 
34986  /// \}
34987 
34988  /// \name Visitor
34989  /// \{
34990 
34991  /**
34992  * \brief visit children i.e. member variables of current node using provided visitor
34993  *
34994  * Different nodes in the AST have different members (i.e. children). This method
34995  * recursively visits children using provided visitor.
34996  *
34997  * \param v Concrete visitor that will be used to recursively visit children
34998  *
34999  * \sa Ast::visit_children for example.
35000  */
35001  void visit_children(visitor::Visitor& v) override;
35002 
35003  /**
35004  * \brief visit children i.e. member variables of current node using provided visitor
35005  *
35006  * Different nodes in the AST have different members (i.e. children). This method
35007  * recursively visits children using provided visitor.
35008  *
35009  * \param v Concrete constant visitor that will be used to recursively visit children
35010  *
35011  * \sa Ast::visit_children for example.
35012  */
35013  void visit_children(visitor::ConstVisitor& v) const override;
35014 
35015  /**
35016  * \brief accept (or visit) the current AST node using provided visitor
35017  *
35018  * Instead of visiting children of AST node, like Ast::visit_children,
35019  * accept allows to visit the current node itself using provided concrete
35020  * visitor.
35021  *
35022  * \param v Concrete visitor that will be used to recursively visit node
35023  *
35024  * \sa Ast::accept for example.
35025  */
35026  void accept(visitor::Visitor& v) override;
35027 
35028  /**
35029  * \copydoc accept(visitor::Visitor&)
35030  */
35031  void accept(visitor::ConstVisitor& v) const override;
35032 
35033  /// \}
35034 
35035 
35036 
35037  private:
35038  /**
35039  * \brief Set this object as parent for all the children
35040  *
35041  * This should be called in every object (with children) constructor
35042  * to set parents. Since it is called only in the constructors it
35043  * should not be virtual to avoid ambiguities (issue #295).
35044  */
35045  void set_parent_in_children();
35046 };
35047 
35048 /** @} */ // end of ast_class
35049 
35050 
35051 } // namespace ast
35052 } // namespace nmodl
35053 #endif // !NMODL_AST_POINTER_HPP
35054 #ifndef NMODL_AST_BBCORE_POINTER_HPP
35055 #define NMODL_AST_BBCORE_POINTER_HPP
35056 
35057 
35058 namespace nmodl {
35059 namespace ast {
35060 
35061 /**
35062  * @addtogroup ast_class
35063  * @ingroup ast
35064  * @{
35065  */
35066 
35067 /**
35068  * \brief Represents BBCOREPOINTER statement in NMODL
35069  *
35070  * Here is an example of BBCOREPOINTER statement:
35071  *
35072  * \code{.mod}
35073  * NEURON {
35074  * THREADSAFE
35075  * POINT_PROCESS ProbAMPANMDA_EMS
35076  * BBCOREPOINTER rng, data
35077  * \endcode
35078  *
35079 */
35080 class BbcorePointer : public Statement {
35081  private:
35082  /// Vector of bbcore pointer variables
35084  /// token with location information
35085  std::shared_ptr<ModToken> token;
35086 
35087  public:
35088 
35089  /// \name Ctor & dtor
35090  /// \{
35091 
35092  explicit BbcorePointer(BbcorePointerVarVector variables);
35093  BbcorePointer(const BbcorePointer& obj);
35094 
35095 
35096  virtual ~BbcorePointer() = default;
35097 
35098  /// \}
35099 
35100 
35101 
35102 
35103 
35104 
35105  /**
35106  * \brief Check if the ast node is an instance of ast::BbcorePointer
35107  * \return true as object is of type ast::BbcorePointer
35108  */
35109  bool is_bbcore_pointer () const noexcept override {
35110  return true;
35111  }
35112 
35113  /**
35114  * \brief Return a copy of the current node
35115  *
35116  * Recursively make a new copy/clone of the current node including
35117  * all members and return a pointer to the node. This is used for
35118  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
35119  * ast.
35120  *
35121  * @return pointer to the clone/copy of the current node
35122  */
35123  BbcorePointer* clone() const override {
35124  return new BbcorePointer(*this);
35125  }
35126 
35127  /// \name Getters
35128  /// \{
35129 
35130  /**
35131  * \brief Return type (ast::AstNodeType) of ast node
35132  *
35133  * Every node in the ast has a type defined in ast::AstNodeType and this
35134  * function is used to retrieve the same.
35135  *
35136  * \return ast node type i.e. ast::AstNodeType::BBCORE_POINTER
35137  *
35138  * \sa Ast::get_node_type_name
35139  */
35140  AstNodeType get_node_type() const noexcept override {
35142  }
35143 
35144  /**
35145  * \brief Return type (ast::AstNodeType) of ast node as std::string
35146  *
35147  * Every node in the ast has a type defined in ast::AstNodeType.
35148  * This type name can be returned as a std::string for printing
35149  * node to text/json form.
35150  *
35151  * \return name of the node type as a string i.e. "BbcorePointer"
35152  *
35153  * \sa Ast::get_node_name
35154  */
35155  std::string get_node_type_name() const noexcept override {
35156  return "BbcorePointer";
35157  }
35158 
35159  /**
35160  * \brief Return NMODL statement of ast node as std::string
35161  *
35162  * Every node is related to a special statement in the NMODL. This
35163  * statement can be returned as a std::string for printing to
35164  * text/json form.
35165  *
35166  * \return name of the statement as a string i.e. "BBCOREPOINTER "
35167  *
35168  * \sa Ast::get_nmodl_name
35169  */
35170  std::string get_nmodl_name() const noexcept override {
35171  return "BBCOREPOINTER ";
35172  }
35173 
35174  /**
35175  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35176  */
35177  std::shared_ptr<Ast> get_shared_ptr() override {
35178  return std::static_pointer_cast<BbcorePointer>(shared_from_this());
35179  }
35180 
35181  /**
35182  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35183  */
35184  std::shared_ptr<const Ast> get_shared_ptr() const override {
35185  return std::static_pointer_cast<const BbcorePointer>(shared_from_this());
35186  }
35187 
35188  /**
35189  * \brief Return associated token for the current ast node
35190  *
35191  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
35192  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
35193  * nullptr to store in the nmodl::symtab::SymbolTable.
35194  *
35195  * \return pointer to token if exist otherwise nullptr
35196  */
35197  const ModToken* get_token() const noexcept override {
35198  return token.get();
35199  }
35200 
35201 
35202 
35203 
35204 
35205 
35206 
35207 
35208  /**
35209  * \brief Getter for member variable \ref BbcorePointer.variables
35210  */
35211  const BbcorePointerVarVector& get_variables() const noexcept {
35212  return variables;
35213  }
35214 
35215 
35216 
35217  /// \}
35218 
35219  /// \name Setters
35220  /// \{
35221 
35222 
35223  /**
35224  * \brief Set token for the current ast node
35225  */
35226  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
35227 
35228 
35229 
35230 
35231  /**
35232  * \brief Setter for member variable \ref BbcorePointer.variables (rvalue reference)
35233  */
35234  void set_variables(BbcorePointerVarVector&& variables);
35235 
35236  /**
35237  * \brief Setter for member variable \ref BbcorePointer.variables
35238  */
35239  void set_variables(const BbcorePointerVarVector& variables);
35240 
35241 
35242  /// \}
35243 
35244  /// \name Visitor
35245  /// \{
35246 
35247  /**
35248  * \brief visit children i.e. member variables of current node using provided visitor
35249  *
35250  * Different nodes in the AST have different members (i.e. children). This method
35251  * recursively visits children using provided visitor.
35252  *
35253  * \param v Concrete visitor that will be used to recursively visit children
35254  *
35255  * \sa Ast::visit_children for example.
35256  */
35257  void visit_children(visitor::Visitor& v) override;
35258 
35259  /**
35260  * \brief visit children i.e. member variables of current node using provided visitor
35261  *
35262  * Different nodes in the AST have different members (i.e. children). This method
35263  * recursively visits children using provided visitor.
35264  *
35265  * \param v Concrete constant visitor that will be used to recursively visit children
35266  *
35267  * \sa Ast::visit_children for example.
35268  */
35269  void visit_children(visitor::ConstVisitor& v) const override;
35270 
35271  /**
35272  * \brief accept (or visit) the current AST node using provided visitor
35273  *
35274  * Instead of visiting children of AST node, like Ast::visit_children,
35275  * accept allows to visit the current node itself using provided concrete
35276  * visitor.
35277  *
35278  * \param v Concrete visitor that will be used to recursively visit node
35279  *
35280  * \sa Ast::accept for example.
35281  */
35282  void accept(visitor::Visitor& v) override;
35283 
35284  /**
35285  * \copydoc accept(visitor::Visitor&)
35286  */
35287  void accept(visitor::ConstVisitor& v) const override;
35288 
35289  /// \}
35290 
35291 
35292 
35293  private:
35294  /**
35295  * \brief Set this object as parent for all the children
35296  *
35297  * This should be called in every object (with children) constructor
35298  * to set parents. Since it is called only in the constructors it
35299  * should not be virtual to avoid ambiguities (issue #295).
35300  */
35301  void set_parent_in_children();
35302 };
35303 
35304 /** @} */ // end of ast_class
35305 
35306 
35307 } // namespace ast
35308 } // namespace nmodl
35309 #endif // !NMODL_AST_BBCORE_POINTER_HPP
35310 #ifndef NMODL_AST_EXTERNAL_HPP
35311 #define NMODL_AST_EXTERNAL_HPP
35312 
35313 
35314 namespace nmodl {
35315 namespace ast {
35316 
35317 /**
35318  * @addtogroup ast_class
35319  * @ingroup ast
35320  * @{
35321  */
35322 
35323 /**
35324  * \brief Represents EXTERNAL statement in NMODL
35325  *
35326  *
35327 */
35328 class External : public Statement {
35329  private:
35330  /// Vector of external variables
35332  /// token with location information
35333  std::shared_ptr<ModToken> token;
35334 
35335  public:
35336 
35337  /// \name Ctor & dtor
35338  /// \{
35339 
35340  explicit External(ExternVarVector variables);
35341  External(const External& obj);
35342 
35343 
35344  virtual ~External() = default;
35345 
35346  /// \}
35347 
35348 
35349 
35350 
35351 
35352 
35353  /**
35354  * \brief Check if the ast node is an instance of ast::External
35355  * \return true as object is of type ast::External
35356  */
35357  bool is_external () const noexcept override {
35358  return true;
35359  }
35360 
35361  /**
35362  * \brief Return a copy of the current node
35363  *
35364  * Recursively make a new copy/clone of the current node including
35365  * all members and return a pointer to the node. This is used for
35366  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
35367  * ast.
35368  *
35369  * @return pointer to the clone/copy of the current node
35370  */
35371  External* clone() const override {
35372  return new External(*this);
35373  }
35374 
35375  /// \name Getters
35376  /// \{
35377 
35378  /**
35379  * \brief Return type (ast::AstNodeType) of ast node
35380  *
35381  * Every node in the ast has a type defined in ast::AstNodeType and this
35382  * function is used to retrieve the same.
35383  *
35384  * \return ast node type i.e. ast::AstNodeType::EXTERNAL
35385  *
35386  * \sa Ast::get_node_type_name
35387  */
35388  AstNodeType get_node_type() const noexcept override {
35389  return AstNodeType::EXTERNAL;
35390  }
35391 
35392  /**
35393  * \brief Return type (ast::AstNodeType) of ast node as std::string
35394  *
35395  * Every node in the ast has a type defined in ast::AstNodeType.
35396  * This type name can be returned as a std::string for printing
35397  * node to text/json form.
35398  *
35399  * \return name of the node type as a string i.e. "External"
35400  *
35401  * \sa Ast::get_node_name
35402  */
35403  std::string get_node_type_name() const noexcept override {
35404  return "External";
35405  }
35406 
35407  /**
35408  * \brief Return NMODL statement of ast node as std::string
35409  *
35410  * Every node is related to a special statement in the NMODL. This
35411  * statement can be returned as a std::string for printing to
35412  * text/json form.
35413  *
35414  * \return name of the statement as a string i.e. "EXTERNAL "
35415  *
35416  * \sa Ast::get_nmodl_name
35417  */
35418  std::string get_nmodl_name() const noexcept override {
35419  return "EXTERNAL ";
35420  }
35421 
35422  /**
35423  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35424  */
35425  std::shared_ptr<Ast> get_shared_ptr() override {
35426  return std::static_pointer_cast<External>(shared_from_this());
35427  }
35428 
35429  /**
35430  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35431  */
35432  std::shared_ptr<const Ast> get_shared_ptr() const override {
35433  return std::static_pointer_cast<const External>(shared_from_this());
35434  }
35435 
35436  /**
35437  * \brief Return associated token for the current ast node
35438  *
35439  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
35440  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
35441  * nullptr to store in the nmodl::symtab::SymbolTable.
35442  *
35443  * \return pointer to token if exist otherwise nullptr
35444  */
35445  const ModToken* get_token() const noexcept override {
35446  return token.get();
35447  }
35448 
35449 
35450 
35451 
35452 
35453 
35454 
35455 
35456  /**
35457  * \brief Getter for member variable \ref External.variables
35458  */
35459  const ExternVarVector& get_variables() const noexcept {
35460  return variables;
35461  }
35462 
35463 
35464 
35465  /// \}
35466 
35467  /// \name Setters
35468  /// \{
35469 
35470 
35471  /**
35472  * \brief Set token for the current ast node
35473  */
35474  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
35475 
35476 
35477 
35478 
35479  /**
35480  * \brief Setter for member variable \ref External.variables (rvalue reference)
35481  */
35482  void set_variables(ExternVarVector&& variables);
35483 
35484  /**
35485  * \brief Setter for member variable \ref External.variables
35486  */
35487  void set_variables(const ExternVarVector& variables);
35488 
35489 
35490  /// \}
35491 
35492  /// \name Visitor
35493  /// \{
35494 
35495  /**
35496  * \brief visit children i.e. member variables of current node using provided visitor
35497  *
35498  * Different nodes in the AST have different members (i.e. children). This method
35499  * recursively visits children using provided visitor.
35500  *
35501  * \param v Concrete visitor that will be used to recursively visit children
35502  *
35503  * \sa Ast::visit_children for example.
35504  */
35505  void visit_children(visitor::Visitor& v) override;
35506 
35507  /**
35508  * \brief visit children i.e. member variables of current node using provided visitor
35509  *
35510  * Different nodes in the AST have different members (i.e. children). This method
35511  * recursively visits children using provided visitor.
35512  *
35513  * \param v Concrete constant visitor that will be used to recursively visit children
35514  *
35515  * \sa Ast::visit_children for example.
35516  */
35517  void visit_children(visitor::ConstVisitor& v) const override;
35518 
35519  /**
35520  * \brief accept (or visit) the current AST node using provided visitor
35521  *
35522  * Instead of visiting children of AST node, like Ast::visit_children,
35523  * accept allows to visit the current node itself using provided concrete
35524  * visitor.
35525  *
35526  * \param v Concrete visitor that will be used to recursively visit node
35527  *
35528  * \sa Ast::accept for example.
35529  */
35530  void accept(visitor::Visitor& v) override;
35531 
35532  /**
35533  * \copydoc accept(visitor::Visitor&)
35534  */
35535  void accept(visitor::ConstVisitor& v) const override;
35536 
35537  /// \}
35538 
35539 
35540 
35541  private:
35542  /**
35543  * \brief Set this object as parent for all the children
35544  *
35545  * This should be called in every object (with children) constructor
35546  * to set parents. Since it is called only in the constructors it
35547  * should not be virtual to avoid ambiguities (issue #295).
35548  */
35549  void set_parent_in_children();
35550 };
35551 
35552 /** @} */ // end of ast_class
35553 
35554 
35555 } // namespace ast
35556 } // namespace nmodl
35557 #endif // !NMODL_AST_EXTERNAL_HPP
35558 #ifndef NMODL_AST_THREAD_SAFE_HPP
35559 #define NMODL_AST_THREAD_SAFE_HPP
35560 
35561 
35562 namespace nmodl {
35563 namespace ast {
35564 
35565 /**
35566  * @addtogroup ast_class
35567  * @ingroup ast
35568  * @{
35569  */
35570 
35571 /**
35572  * \brief Represents THREADSAFE statement in NMODL
35573  *
35574  *
35575 */
35576 class ThreadSafe : public Statement {
35577  private:
35578  /// Vector of thread safe variables
35580  /// token with location information
35581  std::shared_ptr<ModToken> token;
35582 
35583  public:
35584 
35585  /// \name Ctor & dtor
35586  /// \{
35587 
35588  explicit ThreadSafe(ThreadsafeVarVector variables);
35589  ThreadSafe(const ThreadSafe& obj);
35590 
35591 
35592  virtual ~ThreadSafe() = default;
35593 
35594  /// \}
35595 
35596 
35597 
35598 
35599 
35600 
35601  /**
35602  * \brief Check if the ast node is an instance of ast::ThreadSafe
35603  * \return true as object is of type ast::ThreadSafe
35604  */
35605  bool is_thread_safe () const noexcept override {
35606  return true;
35607  }
35608 
35609  /**
35610  * \brief Return a copy of the current node
35611  *
35612  * Recursively make a new copy/clone of the current node including
35613  * all members and return a pointer to the node. This is used for
35614  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
35615  * ast.
35616  *
35617  * @return pointer to the clone/copy of the current node
35618  */
35619  ThreadSafe* clone() const override {
35620  return new ThreadSafe(*this);
35621  }
35622 
35623  /// \name Getters
35624  /// \{
35625 
35626  /**
35627  * \brief Return type (ast::AstNodeType) of ast node
35628  *
35629  * Every node in the ast has a type defined in ast::AstNodeType and this
35630  * function is used to retrieve the same.
35631  *
35632  * \return ast node type i.e. ast::AstNodeType::THREAD_SAFE
35633  *
35634  * \sa Ast::get_node_type_name
35635  */
35636  AstNodeType get_node_type() const noexcept override {
35637  return AstNodeType::THREAD_SAFE;
35638  }
35639 
35640  /**
35641  * \brief Return type (ast::AstNodeType) of ast node as std::string
35642  *
35643  * Every node in the ast has a type defined in ast::AstNodeType.
35644  * This type name can be returned as a std::string for printing
35645  * node to text/json form.
35646  *
35647  * \return name of the node type as a string i.e. "ThreadSafe"
35648  *
35649  * \sa Ast::get_node_name
35650  */
35651  std::string get_node_type_name() const noexcept override {
35652  return "ThreadSafe";
35653  }
35654 
35655  /**
35656  * \brief Return NMODL statement of ast node as std::string
35657  *
35658  * Every node is related to a special statement in the NMODL. This
35659  * statement can be returned as a std::string for printing to
35660  * text/json form.
35661  *
35662  * \return name of the statement as a string i.e. "THREADSAFE"
35663  *
35664  * \sa Ast::get_nmodl_name
35665  */
35666  std::string get_nmodl_name() const noexcept override {
35667  return "THREADSAFE";
35668  }
35669 
35670  /**
35671  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35672  */
35673  std::shared_ptr<Ast> get_shared_ptr() override {
35674  return std::static_pointer_cast<ThreadSafe>(shared_from_this());
35675  }
35676 
35677  /**
35678  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35679  */
35680  std::shared_ptr<const Ast> get_shared_ptr() const override {
35681  return std::static_pointer_cast<const ThreadSafe>(shared_from_this());
35682  }
35683 
35684  /**
35685  * \brief Return associated token for the current ast node
35686  *
35687  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
35688  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
35689  * nullptr to store in the nmodl::symtab::SymbolTable.
35690  *
35691  * \return pointer to token if exist otherwise nullptr
35692  */
35693  const ModToken* get_token() const noexcept override {
35694  return token.get();
35695  }
35696 
35697 
35698 
35699 
35700 
35701 
35702 
35703 
35704  /**
35705  * \brief Getter for member variable \ref ThreadSafe.variables
35706  */
35707  const ThreadsafeVarVector& get_variables() const noexcept {
35708  return variables;
35709  }
35710 
35711 
35712 
35713  /// \}
35714 
35715  /// \name Setters
35716  /// \{
35717 
35718 
35719  /**
35720  * \brief Set token for the current ast node
35721  */
35722  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
35723 
35724 
35725 
35726 
35727  /**
35728  * \brief Setter for member variable \ref ThreadSafe.variables (rvalue reference)
35729  */
35730  void set_variables(ThreadsafeVarVector&& variables);
35731 
35732  /**
35733  * \brief Setter for member variable \ref ThreadSafe.variables
35734  */
35735  void set_variables(const ThreadsafeVarVector& variables);
35736 
35737 
35738  /// \}
35739 
35740  /// \name Visitor
35741  /// \{
35742 
35743  /**
35744  * \brief visit children i.e. member variables of current node using provided visitor
35745  *
35746  * Different nodes in the AST have different members (i.e. children). This method
35747  * recursively visits children using provided visitor.
35748  *
35749  * \param v Concrete visitor that will be used to recursively visit children
35750  *
35751  * \sa Ast::visit_children for example.
35752  */
35753  void visit_children(visitor::Visitor& v) override;
35754 
35755  /**
35756  * \brief visit children i.e. member variables of current node using provided visitor
35757  *
35758  * Different nodes in the AST have different members (i.e. children). This method
35759  * recursively visits children using provided visitor.
35760  *
35761  * \param v Concrete constant visitor that will be used to recursively visit children
35762  *
35763  * \sa Ast::visit_children for example.
35764  */
35765  void visit_children(visitor::ConstVisitor& v) const override;
35766 
35767  /**
35768  * \brief accept (or visit) the current AST node using provided visitor
35769  *
35770  * Instead of visiting children of AST node, like Ast::visit_children,
35771  * accept allows to visit the current node itself using provided concrete
35772  * visitor.
35773  *
35774  * \param v Concrete visitor that will be used to recursively visit node
35775  *
35776  * \sa Ast::accept for example.
35777  */
35778  void accept(visitor::Visitor& v) override;
35779 
35780  /**
35781  * \copydoc accept(visitor::Visitor&)
35782  */
35783  void accept(visitor::ConstVisitor& v) const override;
35784 
35785  /// \}
35786 
35787 
35788 
35789  private:
35790  /**
35791  * \brief Set this object as parent for all the children
35792  *
35793  * This should be called in every object (with children) constructor
35794  * to set parents. Since it is called only in the constructors it
35795  * should not be virtual to avoid ambiguities (issue #295).
35796  */
35797  void set_parent_in_children();
35798 };
35799 
35800 /** @} */ // end of ast_class
35801 
35802 
35803 } // namespace ast
35804 } // namespace nmodl
35805 #endif // !NMODL_AST_THREAD_SAFE_HPP
35806 #ifndef NMODL_AST_VERBATIM_HPP
35807 #define NMODL_AST_VERBATIM_HPP
35808 
35809 
35810 namespace nmodl {
35811 namespace ast {
35812 
35813 /**
35814  * @addtogroup ast_class
35815  * @ingroup ast
35816  * @{
35817  */
35818 
35819 /**
35820  * \brief Represents a C code block
35821  *
35822  *
35823 */
35824 class Verbatim : public Statement {
35825  private:
35826  /// C code as a string
35827  std::shared_ptr<String> statement;
35828  /// token with location information
35829  std::shared_ptr<ModToken> token;
35830 
35831  public:
35832 
35833  /// \name Ctor & dtor
35834  /// \{
35835 
35836  explicit Verbatim(String* statement);
35837  explicit Verbatim(const std::shared_ptr<String>& statement);
35838  Verbatim(const Verbatim& obj);
35839 
35840 
35841  virtual ~Verbatim() = default;
35842 
35843  /// \}
35844 
35845 
35846 
35847 
35848 
35849 
35850  /**
35851  * \brief Check if the ast node is an instance of ast::Verbatim
35852  * \return true as object is of type ast::Verbatim
35853  */
35854  bool is_verbatim () const noexcept override {
35855  return true;
35856  }
35857 
35858  /**
35859  * \brief Return a copy of the current node
35860  *
35861  * Recursively make a new copy/clone of the current node including
35862  * all members and return a pointer to the node. This is used for
35863  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
35864  * ast.
35865  *
35866  * @return pointer to the clone/copy of the current node
35867  */
35868  Verbatim* clone() const override {
35869  return new Verbatim(*this);
35870  }
35871 
35872  /// \name Getters
35873  /// \{
35874 
35875  /**
35876  * \brief Return type (ast::AstNodeType) of ast node
35877  *
35878  * Every node in the ast has a type defined in ast::AstNodeType and this
35879  * function is used to retrieve the same.
35880  *
35881  * \return ast node type i.e. ast::AstNodeType::VERBATIM
35882  *
35883  * \sa Ast::get_node_type_name
35884  */
35885  AstNodeType get_node_type() const noexcept override {
35886  return AstNodeType::VERBATIM;
35887  }
35888 
35889  /**
35890  * \brief Return type (ast::AstNodeType) of ast node as std::string
35891  *
35892  * Every node in the ast has a type defined in ast::AstNodeType.
35893  * This type name can be returned as a std::string for printing
35894  * node to text/json form.
35895  *
35896  * \return name of the node type as a string i.e. "Verbatim"
35897  *
35898  * \sa Ast::get_node_name
35899  */
35900  std::string get_node_type_name() const noexcept override {
35901  return "Verbatim";
35902  }
35903 
35904  /**
35905  * \brief Return NMODL statement of ast node as std::string
35906  *
35907  * Every node is related to a special statement in the NMODL. This
35908  * statement can be returned as a std::string for printing to
35909  * text/json form.
35910  *
35911  * \return name of the statement as a string i.e. "VERBATIM"
35912  *
35913  * \sa Ast::get_nmodl_name
35914  */
35915  std::string get_nmodl_name() const noexcept override {
35916  return "VERBATIM";
35917  }
35918 
35919  /**
35920  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35921  */
35922  std::shared_ptr<Ast> get_shared_ptr() override {
35923  return std::static_pointer_cast<Verbatim>(shared_from_this());
35924  }
35925 
35926  /**
35927  * \brief Get std::shared_ptr from `this` pointer of the current ast node
35928  */
35929  std::shared_ptr<const Ast> get_shared_ptr() const override {
35930  return std::static_pointer_cast<const Verbatim>(shared_from_this());
35931  }
35932 
35933  /**
35934  * \brief Return associated token for the current ast node
35935  *
35936  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
35937  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
35938  * nullptr to store in the nmodl::symtab::SymbolTable.
35939  *
35940  * \return pointer to token if exist otherwise nullptr
35941  */
35942  const ModToken* get_token() const noexcept override {
35943  return token.get();
35944  }
35945 
35946 
35947 
35948 
35949 
35950 
35951 
35952 
35953  /**
35954  * \brief Getter for member variable \ref Verbatim.statement
35955  */
35956  const std::shared_ptr<String>& get_statement() const noexcept {
35957  return statement;
35958  }
35959 
35960 
35961 
35962  /// \}
35963 
35964  /// \name Setters
35965  /// \{
35966 
35967 
35968  /**
35969  * \brief Set token for the current ast node
35970  */
35971  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
35972 
35973 
35974 
35975 
35976  /**
35977  * \brief Setter for member variable \ref Verbatim.statement (rvalue reference)
35978  */
35979  void set_statement(std::shared_ptr<String>&& statement);
35980 
35981  /**
35982  * \brief Setter for member variable \ref Verbatim.statement
35983  */
35984  void set_statement(const std::shared_ptr<String>& statement);
35985 
35986 
35987  /// \}
35988 
35989  /// \name Visitor
35990  /// \{
35991 
35992  /**
35993  * \brief visit children i.e. member variables of current node using provided visitor
35994  *
35995  * Different nodes in the AST have different members (i.e. children). This method
35996  * recursively visits children using provided visitor.
35997  *
35998  * \param v Concrete visitor that will be used to recursively visit children
35999  *
36000  * \sa Ast::visit_children for example.
36001  */
36002  void visit_children(visitor::Visitor& v) override;
36003 
36004  /**
36005  * \brief visit children i.e. member variables of current node using provided visitor
36006  *
36007  * Different nodes in the AST have different members (i.e. children). This method
36008  * recursively visits children using provided visitor.
36009  *
36010  * \param v Concrete constant visitor that will be used to recursively visit children
36011  *
36012  * \sa Ast::visit_children for example.
36013  */
36014  void visit_children(visitor::ConstVisitor& v) const override;
36015 
36016  /**
36017  * \brief accept (or visit) the current AST node using provided visitor
36018  *
36019  * Instead of visiting children of AST node, like Ast::visit_children,
36020  * accept allows to visit the current node itself using provided concrete
36021  * visitor.
36022  *
36023  * \param v Concrete visitor that will be used to recursively visit node
36024  *
36025  * \sa Ast::accept for example.
36026  */
36027  void accept(visitor::Visitor& v) override;
36028 
36029  /**
36030  * \copydoc accept(visitor::Visitor&)
36031  */
36032  void accept(visitor::ConstVisitor& v) const override;
36033 
36034  /// \}
36035 
36036 
36037 
36038  private:
36039  /**
36040  * \brief Set this object as parent for all the children
36041  *
36042  * This should be called in every object (with children) constructor
36043  * to set parents. Since it is called only in the constructors it
36044  * should not be virtual to avoid ambiguities (issue #295).
36045  */
36046  void set_parent_in_children();
36047 };
36048 
36049 /** @} */ // end of ast_class
36050 
36051 
36052 } // namespace ast
36053 } // namespace nmodl
36054 #endif // !NMODL_AST_VERBATIM_HPP
36055 #ifndef NMODL_AST_LINE_COMMENT_HPP
36056 #define NMODL_AST_LINE_COMMENT_HPP
36057 
36058 
36059 namespace nmodl {
36060 namespace ast {
36061 
36062 /**
36063  * @addtogroup ast_class
36064  * @ingroup ast
36065  * @{
36066  */
36067 
36068 /**
36069  * \brief Represents a one line comment in NMODL
36070  *
36071  *
36072 */
36073 class LineComment : public Statement {
36074  private:
36075  /// comment text
36076  std::shared_ptr<String> statement;
36077  /// token with location information
36078  std::shared_ptr<ModToken> token;
36079 
36080  public:
36081 
36082  /// \name Ctor & dtor
36083  /// \{
36084 
36085  explicit LineComment(String* statement);
36086  explicit LineComment(const std::shared_ptr<String>& statement);
36087  LineComment(const LineComment& obj);
36088 
36089 
36090  virtual ~LineComment() = default;
36091 
36092  /// \}
36093 
36094 
36095 
36096 
36097 
36098 
36099  /**
36100  * \brief Check if the ast node is an instance of ast::LineComment
36101  * \return true as object is of type ast::LineComment
36102  */
36103  bool is_line_comment () const noexcept override {
36104  return true;
36105  }
36106 
36107  /**
36108  * \brief Return a copy of the current node
36109  *
36110  * Recursively make a new copy/clone of the current node including
36111  * all members and return a pointer to the node. This is used for
36112  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
36113  * ast.
36114  *
36115  * @return pointer to the clone/copy of the current node
36116  */
36117  LineComment* clone() const override {
36118  return new LineComment(*this);
36119  }
36120 
36121  /// \name Getters
36122  /// \{
36123 
36124  /**
36125  * \brief Return type (ast::AstNodeType) of ast node
36126  *
36127  * Every node in the ast has a type defined in ast::AstNodeType and this
36128  * function is used to retrieve the same.
36129  *
36130  * \return ast node type i.e. ast::AstNodeType::LINE_COMMENT
36131  *
36132  * \sa Ast::get_node_type_name
36133  */
36134  AstNodeType get_node_type() const noexcept override {
36136  }
36137 
36138  /**
36139  * \brief Return type (ast::AstNodeType) of ast node as std::string
36140  *
36141  * Every node in the ast has a type defined in ast::AstNodeType.
36142  * This type name can be returned as a std::string for printing
36143  * node to text/json form.
36144  *
36145  * \return name of the node type as a string i.e. "LineComment"
36146  *
36147  * \sa Ast::get_node_name
36148  */
36149  std::string get_node_type_name() const noexcept override {
36150  return "LineComment";
36151  }
36152 
36153 
36154  /**
36155  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36156  */
36157  std::shared_ptr<Ast> get_shared_ptr() override {
36158  return std::static_pointer_cast<LineComment>(shared_from_this());
36159  }
36160 
36161  /**
36162  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36163  */
36164  std::shared_ptr<const Ast> get_shared_ptr() const override {
36165  return std::static_pointer_cast<const LineComment>(shared_from_this());
36166  }
36167 
36168  /**
36169  * \brief Return associated token for the current ast node
36170  *
36171  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
36172  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
36173  * nullptr to store in the nmodl::symtab::SymbolTable.
36174  *
36175  * \return pointer to token if exist otherwise nullptr
36176  */
36177  const ModToken* get_token() const noexcept override {
36178  return token.get();
36179  }
36180 
36181 
36182 
36183 
36184 
36185 
36186 
36187 
36188  /**
36189  * \brief Getter for member variable \ref LineComment.statement
36190  */
36191  const std::shared_ptr<String>& get_statement() const noexcept {
36192  return statement;
36193  }
36194 
36195 
36196 
36197  /// \}
36198 
36199  /// \name Setters
36200  /// \{
36201 
36202 
36203  /**
36204  * \brief Set token for the current ast node
36205  */
36206  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
36207 
36208 
36209 
36210 
36211  /**
36212  * \brief Setter for member variable \ref LineComment.statement (rvalue reference)
36213  */
36214  void set_statement(std::shared_ptr<String>&& statement);
36215 
36216  /**
36217  * \brief Setter for member variable \ref LineComment.statement
36218  */
36219  void set_statement(const std::shared_ptr<String>& statement);
36220 
36221 
36222  /// \}
36223 
36224  /// \name Visitor
36225  /// \{
36226 
36227  /**
36228  * \brief visit children i.e. member variables of current node using provided visitor
36229  *
36230  * Different nodes in the AST have different members (i.e. children). This method
36231  * recursively visits children using provided visitor.
36232  *
36233  * \param v Concrete visitor that will be used to recursively visit children
36234  *
36235  * \sa Ast::visit_children for example.
36236  */
36237  void visit_children(visitor::Visitor& v) override;
36238 
36239  /**
36240  * \brief visit children i.e. member variables of current node using provided visitor
36241  *
36242  * Different nodes in the AST have different members (i.e. children). This method
36243  * recursively visits children using provided visitor.
36244  *
36245  * \param v Concrete constant visitor that will be used to recursively visit children
36246  *
36247  * \sa Ast::visit_children for example.
36248  */
36249  void visit_children(visitor::ConstVisitor& v) const override;
36250 
36251  /**
36252  * \brief accept (or visit) the current AST node using provided visitor
36253  *
36254  * Instead of visiting children of AST node, like Ast::visit_children,
36255  * accept allows to visit the current node itself using provided concrete
36256  * visitor.
36257  *
36258  * \param v Concrete visitor that will be used to recursively visit node
36259  *
36260  * \sa Ast::accept for example.
36261  */
36262  void accept(visitor::Visitor& v) override;
36263 
36264  /**
36265  * \copydoc accept(visitor::Visitor&)
36266  */
36267  void accept(visitor::ConstVisitor& v) const override;
36268 
36269  /// \}
36270 
36271 
36272 
36273  private:
36274  /**
36275  * \brief Set this object as parent for all the children
36276  *
36277  * This should be called in every object (with children) constructor
36278  * to set parents. Since it is called only in the constructors it
36279  * should not be virtual to avoid ambiguities (issue #295).
36280  */
36281  void set_parent_in_children();
36282 };
36283 
36284 /** @} */ // end of ast_class
36285 
36286 
36287 } // namespace ast
36288 } // namespace nmodl
36289 #endif // !NMODL_AST_LINE_COMMENT_HPP
36290 #ifndef NMODL_AST_BLOCK_COMMENT_HPP
36291 #define NMODL_AST_BLOCK_COMMENT_HPP
36292 
36293 
36294 namespace nmodl {
36295 namespace ast {
36296 
36297 /**
36298  * @addtogroup ast_class
36299  * @ingroup ast
36300  * @{
36301  */
36302 
36303 /**
36304  * \brief Represents a multi-line comment in NMODL
36305  *
36306  *
36307 */
36308 class BlockComment : public Statement {
36309  private:
36310  /// comment text
36311  std::shared_ptr<String> statement;
36312  /// token with location information
36313  std::shared_ptr<ModToken> token;
36314 
36315  public:
36316 
36317  /// \name Ctor & dtor
36318  /// \{
36319 
36320  explicit BlockComment(String* statement);
36321  explicit BlockComment(const std::shared_ptr<String>& statement);
36322  BlockComment(const BlockComment& obj);
36323 
36324 
36325  virtual ~BlockComment() = default;
36326 
36327  /// \}
36328 
36329 
36330 
36331 
36332 
36333 
36334  /**
36335  * \brief Check if the ast node is an instance of ast::BlockComment
36336  * \return true as object is of type ast::BlockComment
36337  */
36338  bool is_block_comment () const noexcept override {
36339  return true;
36340  }
36341 
36342  /**
36343  * \brief Return a copy of the current node
36344  *
36345  * Recursively make a new copy/clone of the current node including
36346  * all members and return a pointer to the node. This is used for
36347  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
36348  * ast.
36349  *
36350  * @return pointer to the clone/copy of the current node
36351  */
36352  BlockComment* clone() const override {
36353  return new BlockComment(*this);
36354  }
36355 
36356  /// \name Getters
36357  /// \{
36358 
36359  /**
36360  * \brief Return type (ast::AstNodeType) of ast node
36361  *
36362  * Every node in the ast has a type defined in ast::AstNodeType and this
36363  * function is used to retrieve the same.
36364  *
36365  * \return ast node type i.e. ast::AstNodeType::BLOCK_COMMENT
36366  *
36367  * \sa Ast::get_node_type_name
36368  */
36369  AstNodeType get_node_type() const noexcept override {
36371  }
36372 
36373  /**
36374  * \brief Return type (ast::AstNodeType) of ast node as std::string
36375  *
36376  * Every node in the ast has a type defined in ast::AstNodeType.
36377  * This type name can be returned as a std::string for printing
36378  * node to text/json form.
36379  *
36380  * \return name of the node type as a string i.e. "BlockComment"
36381  *
36382  * \sa Ast::get_node_name
36383  */
36384  std::string get_node_type_name() const noexcept override {
36385  return "BlockComment";
36386  }
36387 
36388  /**
36389  * \brief Return NMODL statement of ast node as std::string
36390  *
36391  * Every node is related to a special statement in the NMODL. This
36392  * statement can be returned as a std::string for printing to
36393  * text/json form.
36394  *
36395  * \return name of the statement as a string i.e. "COMMENT"
36396  *
36397  * \sa Ast::get_nmodl_name
36398  */
36399  std::string get_nmodl_name() const noexcept override {
36400  return "COMMENT";
36401  }
36402 
36403  /**
36404  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36405  */
36406  std::shared_ptr<Ast> get_shared_ptr() override {
36407  return std::static_pointer_cast<BlockComment>(shared_from_this());
36408  }
36409 
36410  /**
36411  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36412  */
36413  std::shared_ptr<const Ast> get_shared_ptr() const override {
36414  return std::static_pointer_cast<const BlockComment>(shared_from_this());
36415  }
36416 
36417  /**
36418  * \brief Return associated token for the current ast node
36419  *
36420  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
36421  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
36422  * nullptr to store in the nmodl::symtab::SymbolTable.
36423  *
36424  * \return pointer to token if exist otherwise nullptr
36425  */
36426  const ModToken* get_token() const noexcept override {
36427  return token.get();
36428  }
36429 
36430 
36431 
36432 
36433 
36434 
36435 
36436 
36437  /**
36438  * \brief Getter for member variable \ref BlockComment.statement
36439  */
36440  const std::shared_ptr<String>& get_statement() const noexcept {
36441  return statement;
36442  }
36443 
36444 
36445 
36446  /// \}
36447 
36448  /// \name Setters
36449  /// \{
36450 
36451 
36452  /**
36453  * \brief Set token for the current ast node
36454  */
36455  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
36456 
36457 
36458 
36459 
36460  /**
36461  * \brief Setter for member variable \ref BlockComment.statement (rvalue reference)
36462  */
36463  void set_statement(std::shared_ptr<String>&& statement);
36464 
36465  /**
36466  * \brief Setter for member variable \ref BlockComment.statement
36467  */
36468  void set_statement(const std::shared_ptr<String>& statement);
36469 
36470 
36471  /// \}
36472 
36473  /// \name Visitor
36474  /// \{
36475 
36476  /**
36477  * \brief visit children i.e. member variables of current node using provided visitor
36478  *
36479  * Different nodes in the AST have different members (i.e. children). This method
36480  * recursively visits children using provided visitor.
36481  *
36482  * \param v Concrete visitor that will be used to recursively visit children
36483  *
36484  * \sa Ast::visit_children for example.
36485  */
36486  void visit_children(visitor::Visitor& v) override;
36487 
36488  /**
36489  * \brief visit children i.e. member variables of current node using provided visitor
36490  *
36491  * Different nodes in the AST have different members (i.e. children). This method
36492  * recursively visits children using provided visitor.
36493  *
36494  * \param v Concrete constant visitor that will be used to recursively visit children
36495  *
36496  * \sa Ast::visit_children for example.
36497  */
36498  void visit_children(visitor::ConstVisitor& v) const override;
36499 
36500  /**
36501  * \brief accept (or visit) the current AST node using provided visitor
36502  *
36503  * Instead of visiting children of AST node, like Ast::visit_children,
36504  * accept allows to visit the current node itself using provided concrete
36505  * visitor.
36506  *
36507  * \param v Concrete visitor that will be used to recursively visit node
36508  *
36509  * \sa Ast::accept for example.
36510  */
36511  void accept(visitor::Visitor& v) override;
36512 
36513  /**
36514  * \copydoc accept(visitor::Visitor&)
36515  */
36516  void accept(visitor::ConstVisitor& v) const override;
36517 
36518  /// \}
36519 
36520 
36521 
36522  private:
36523  /**
36524  * \brief Set this object as parent for all the children
36525  *
36526  * This should be called in every object (with children) constructor
36527  * to set parents. Since it is called only in the constructors it
36528  * should not be virtual to avoid ambiguities (issue #295).
36529  */
36530  void set_parent_in_children();
36531 };
36532 
36533 /** @} */ // end of ast_class
36534 
36535 
36536 } // namespace ast
36537 } // namespace nmodl
36538 #endif // !NMODL_AST_BLOCK_COMMENT_HPP
36539 #ifndef NMODL_AST_ONTOLOGY_STATEMENT_HPP
36540 #define NMODL_AST_ONTOLOGY_STATEMENT_HPP
36541 
36542 
36543 namespace nmodl {
36544 namespace ast {
36545 
36546 /**
36547  * @addtogroup ast_class
36548  * @ingroup ast
36549  * @{
36550  */
36551 
36552 /**
36553  * \brief Represents CURIE information in NMODL
36554  *
36555  *
36556 */
36558  private:
36559  /// Ontology name
36560  std::shared_ptr<String> ontology_id;
36561  /// token with location information
36562  std::shared_ptr<ModToken> token;
36563 
36564  public:
36565 
36566  /// \name Ctor & dtor
36567  /// \{
36568 
36569  explicit OntologyStatement(String* ontology_id);
36570  explicit OntologyStatement(const std::shared_ptr<String>& ontology_id);
36572 
36573 
36574  virtual ~OntologyStatement() = default;
36575 
36576  /// \}
36577 
36578 
36579 
36580 
36581 
36582 
36583  /**
36584  * \brief Check if the ast node is an instance of ast::OntologyStatement
36585  * \return true as object is of type ast::OntologyStatement
36586  */
36587  bool is_ontology_statement () const noexcept override {
36588  return true;
36589  }
36590 
36591  /**
36592  * \brief Return a copy of the current node
36593  *
36594  * Recursively make a new copy/clone of the current node including
36595  * all members and return a pointer to the node. This is used for
36596  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
36597  * ast.
36598  *
36599  * @return pointer to the clone/copy of the current node
36600  */
36601  OntologyStatement* clone() const override {
36602  return new OntologyStatement(*this);
36603  }
36604 
36605  /// \name Getters
36606  /// \{
36607 
36608  /**
36609  * \brief Return type (ast::AstNodeType) of ast node
36610  *
36611  * Every node in the ast has a type defined in ast::AstNodeType and this
36612  * function is used to retrieve the same.
36613  *
36614  * \return ast node type i.e. ast::AstNodeType::ONTOLOGY_STATEMENT
36615  *
36616  * \sa Ast::get_node_type_name
36617  */
36618  AstNodeType get_node_type() const noexcept override {
36620  }
36621 
36622  /**
36623  * \brief Return type (ast::AstNodeType) of ast node as std::string
36624  *
36625  * Every node in the ast has a type defined in ast::AstNodeType.
36626  * This type name can be returned as a std::string for printing
36627  * node to text/json form.
36628  *
36629  * \return name of the node type as a string i.e. "OntologyStatement"
36630  *
36631  * \sa Ast::get_node_name
36632  */
36633  std::string get_node_type_name() const noexcept override {
36634  return "OntologyStatement";
36635  }
36636 
36637  /**
36638  * \brief Return NMODL statement of ast node as std::string
36639  *
36640  * Every node is related to a special statement in the NMODL. This
36641  * statement can be returned as a std::string for printing to
36642  * text/json form.
36643  *
36644  * \return name of the statement as a string i.e. "REPRESENTS "
36645  *
36646  * \sa Ast::get_nmodl_name
36647  */
36648  std::string get_nmodl_name() const noexcept override {
36649  return "REPRESENTS ";
36650  }
36651 
36652  /**
36653  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36654  */
36655  std::shared_ptr<Ast> get_shared_ptr() override {
36656  return std::static_pointer_cast<OntologyStatement>(shared_from_this());
36657  }
36658 
36659  /**
36660  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36661  */
36662  std::shared_ptr<const Ast> get_shared_ptr() const override {
36663  return std::static_pointer_cast<const OntologyStatement>(shared_from_this());
36664  }
36665 
36666  /**
36667  * \brief Return associated token for the current ast node
36668  *
36669  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
36670  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
36671  * nullptr to store in the nmodl::symtab::SymbolTable.
36672  *
36673  * \return pointer to token if exist otherwise nullptr
36674  */
36675  const ModToken* get_token() const noexcept override {
36676  return token.get();
36677  }
36678 
36679 
36680 
36681 
36682 
36683 
36684 
36685 
36686  /**
36687  * \brief Getter for member variable \ref OntologyStatement.ontology_id
36688  */
36689  const std::shared_ptr<String>& get_ontology_id() const noexcept {
36690  return ontology_id;
36691  }
36692 
36693 
36694 
36695  /// \}
36696 
36697  /// \name Setters
36698  /// \{
36699 
36700 
36701  /**
36702  * \brief Set token for the current ast node
36703  */
36704  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
36705 
36706 
36707 
36708 
36709  /**
36710  * \brief Setter for member variable \ref OntologyStatement.ontology_id (rvalue reference)
36711  */
36712  void set_ontology_id(std::shared_ptr<String>&& ontology_id);
36713 
36714  /**
36715  * \brief Setter for member variable \ref OntologyStatement.ontology_id
36716  */
36717  void set_ontology_id(const std::shared_ptr<String>& ontology_id);
36718 
36719 
36720  /// \}
36721 
36722  /// \name Visitor
36723  /// \{
36724 
36725  /**
36726  * \brief visit children i.e. member variables of current node using provided visitor
36727  *
36728  * Different nodes in the AST have different members (i.e. children). This method
36729  * recursively visits children using provided visitor.
36730  *
36731  * \param v Concrete visitor that will be used to recursively visit children
36732  *
36733  * \sa Ast::visit_children for example.
36734  */
36735  void visit_children(visitor::Visitor& v) override;
36736 
36737  /**
36738  * \brief visit children i.e. member variables of current node using provided visitor
36739  *
36740  * Different nodes in the AST have different members (i.e. children). This method
36741  * recursively visits children using provided visitor.
36742  *
36743  * \param v Concrete constant visitor that will be used to recursively visit children
36744  *
36745  * \sa Ast::visit_children for example.
36746  */
36747  void visit_children(visitor::ConstVisitor& v) const override;
36748 
36749  /**
36750  * \brief accept (or visit) the current AST node using provided visitor
36751  *
36752  * Instead of visiting children of AST node, like Ast::visit_children,
36753  * accept allows to visit the current node itself using provided concrete
36754  * visitor.
36755  *
36756  * \param v Concrete visitor that will be used to recursively visit node
36757  *
36758  * \sa Ast::accept for example.
36759  */
36760  void accept(visitor::Visitor& v) override;
36761 
36762  /**
36763  * \copydoc accept(visitor::Visitor&)
36764  */
36765  void accept(visitor::ConstVisitor& v) const override;
36766 
36767  /// \}
36768 
36769 
36770 
36771  private:
36772  /**
36773  * \brief Set this object as parent for all the children
36774  *
36775  * This should be called in every object (with children) constructor
36776  * to set parents. Since it is called only in the constructors it
36777  * should not be virtual to avoid ambiguities (issue #295).
36778  */
36779  void set_parent_in_children();
36780 };
36781 
36782 /** @} */ // end of ast_class
36783 
36784 
36785 } // namespace ast
36786 } // namespace nmodl
36787 #endif // !NMODL_AST_ONTOLOGY_STATEMENT_HPP
36788 #ifndef NMODL_AST_PROGRAM_HPP
36789 #define NMODL_AST_PROGRAM_HPP
36790 #define NMODL_AST_PROGRAM_HPP_INLINE_DEFINITION_REQUIRED
36791 
36792 
36793 namespace nmodl {
36794 namespace ast {
36795 
36796 /**
36797  * @addtogroup ast_class
36798  * @ingroup ast
36799  * @{
36800  */
36801 
36802 /**
36803  * \brief Represents top level AST node for whole NMODL input
36804  *
36805  *
36806 */
36807 class Program : public Ast {
36808  private:
36809  /// Vector of top level blocks in the mod file
36811  /// token with location information
36812  std::shared_ptr<ModToken> token;
36813  /// symbol table for a block
36814  symtab::SymbolTable* symtab = nullptr;
36815  /// global symbol table for model
36817 
36818  public:
36819 
36820  /// \name Ctor & dtor
36821  /// \{
36822 
36823  explicit Program(NodeVector blocks);
36824  Program(const Program& obj);
36825 
36826  Program() = default;
36827 
36828  virtual ~Program() = default;
36829 
36830  /// \}
36831 
36832 
36833 
36834 
36835 
36836 
36837  /**
36838  * \brief Check if the ast node is an instance of ast::Program
36839  * \return true as object is of type ast::Program
36840  */
36841  bool is_program () const noexcept override {
36842  return true;
36843  }
36844 
36845  /**
36846  * \brief Return a copy of the current node
36847  *
36848  * Recursively make a new copy/clone of the current node including
36849  * all members and return a pointer to the node. This is used for
36850  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
36851  * ast.
36852  *
36853  * @return pointer to the clone/copy of the current node
36854  */
36855  Program* clone() const override {
36856  return new Program(*this);
36857  }
36858 
36859  /// \name Getters
36860  /// \{
36861 
36862  /**
36863  * \brief Return type (ast::AstNodeType) of ast node
36864  *
36865  * Every node in the ast has a type defined in ast::AstNodeType and this
36866  * function is used to retrieve the same.
36867  *
36868  * \return ast node type i.e. ast::AstNodeType::PROGRAM
36869  *
36870  * \sa Ast::get_node_type_name
36871  */
36872  AstNodeType get_node_type() const noexcept override {
36873  return AstNodeType::PROGRAM;
36874  }
36875 
36876  /**
36877  * \brief Return type (ast::AstNodeType) of ast node as std::string
36878  *
36879  * Every node in the ast has a type defined in ast::AstNodeType.
36880  * This type name can be returned as a std::string for printing
36881  * node to text/json form.
36882  *
36883  * \return name of the node type as a string i.e. "Program"
36884  *
36885  * \sa Ast::get_node_name
36886  */
36887  std::string get_node_type_name() const noexcept override {
36888  return "Program";
36889  }
36890 
36891 
36892  /**
36893  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36894  */
36895  std::shared_ptr<Ast> get_shared_ptr() override {
36896  return std::static_pointer_cast<Program>(shared_from_this());
36897  }
36898 
36899  /**
36900  * \brief Get std::shared_ptr from `this` pointer of the current ast node
36901  */
36902  std::shared_ptr<const Ast> get_shared_ptr() const override {
36903  return std::static_pointer_cast<const Program>(shared_from_this());
36904  }
36905 
36906  /**
36907  * \brief Return associated token for the current ast node
36908  *
36909  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
36910  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
36911  * nullptr to store in the nmodl::symtab::SymbolTable.
36912  *
36913  * \return pointer to token if exist otherwise nullptr
36914  */
36915  const ModToken* get_token() const noexcept override {
36916  return token.get();
36917  }
36918 
36919  /**
36920  * \brief Return associated symbol table for the current ast node
36921  *
36922  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
36923  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
36924  * and it can be accessed using this method.
36925  *
36926  * \return pointer to the symbol table
36927  *
36928  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
36929  */
36931  return symtab;
36932  }
36933 
36934 
36935  /**
36936  * \brief Return global symbol table for the mod file
36937  */
36939  return &model_symtab;
36940  }
36941 
36942 
36943 /**
36944  * \brief Add member to blocks by raw pointer
36945  */
36946 void emplace_back_node(Node *n);
36947 
36948 /**
36949  * \brief Add member to blocks by shared_ptr
36950  */
36951 void emplace_back_node(std::shared_ptr<Node> n);
36952 
36953 /**
36954  * \brief Erase member to blocks
36955  */
36956 NodeVector::const_iterator erase_node(NodeVector::const_iterator first);
36957 
36958 /**
36959  * \brief Erase members to blocks
36960  */
36961 NodeVector::const_iterator erase_node(NodeVector::const_iterator first, NodeVector::const_iterator last);
36962 
36963 /**
36964  * \brief Erase non-consecutive members to blocks
36965  *
36966  * loosely following the cpp reference of remove_if
36967  */
36968 size_t erase_node(std::unordered_set<Node*>& to_be_erased);
36969 
36970 /**
36971  * \brief Insert member to blocks
36972  */
36973 NodeVector::const_iterator insert_node(NodeVector::const_iterator position, const std::shared_ptr<Node>& n);
36974 
36975 /**
36976  * \brief Insert members to blocks
36977  */
36978 template <class NodeType, class InputIterator>
36979 void insert_node(NodeVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last);
36980 
36981 /**
36982  * \brief Reset member to blocks
36983  */
36984 void reset_node(NodeVector::const_iterator position, Node* n);
36985 
36986 /**
36987  * \brief Reset member to blocks
36988  */
36989 void reset_node(NodeVector::const_iterator position, std::shared_ptr<Node> n);
36990 
36991 
36992 
36993 
36994 
36995  /**
36996  * \brief Getter for member variable \ref Program.blocks
36997  */
36998  const NodeVector& get_blocks() const noexcept {
36999  return blocks;
37000  }
37001 
37002 
37003 
37004  /// \}
37005 
37006  /// \name Setters
37007  /// \{
37008 
37009 
37010  /**
37011  * \brief Set token for the current ast node
37012  */
37013  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
37014 
37015  /**
37016  * \brief Set symbol table for the current ast node
37017  *
37018  * Top level, block scoped nodes store symbol table in the ast node.
37019  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
37020  * for every node in the ast.
37021  *
37022  * \sa nmodl::visitor::SymtabVisitor
37023  */
37024  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
37025  symtab = newsymtab;
37026  }
37027 
37028 
37029 
37030  /**
37031  * \brief Setter for member variable \ref Program.blocks (rvalue reference)
37032  */
37033  void set_blocks(NodeVector&& blocks);
37034 
37035  /**
37036  * \brief Setter for member variable \ref Program.blocks
37037  */
37038  void set_blocks(const NodeVector& blocks);
37039 
37040 
37041  /// \}
37042 
37043  /// \name Visitor
37044  /// \{
37045 
37046  /**
37047  * \brief visit children i.e. member variables of current node using provided visitor
37048  *
37049  * Different nodes in the AST have different members (i.e. children). This method
37050  * recursively visits children using provided visitor.
37051  *
37052  * \param v Concrete visitor that will be used to recursively visit children
37053  *
37054  * \sa Ast::visit_children for example.
37055  */
37056  void visit_children(visitor::Visitor& v) override;
37057 
37058  /**
37059  * \brief visit children i.e. member variables of current node using provided visitor
37060  *
37061  * Different nodes in the AST have different members (i.e. children). This method
37062  * recursively visits children using provided visitor.
37063  *
37064  * \param v Concrete constant visitor that will be used to recursively visit children
37065  *
37066  * \sa Ast::visit_children for example.
37067  */
37068  void visit_children(visitor::ConstVisitor& v) const override;
37069 
37070  /**
37071  * \brief accept (or visit) the current AST node using provided visitor
37072  *
37073  * Instead of visiting children of AST node, like Ast::visit_children,
37074  * accept allows to visit the current node itself using provided concrete
37075  * visitor.
37076  *
37077  * \param v Concrete visitor that will be used to recursively visit node
37078  *
37079  * \sa Ast::accept for example.
37080  */
37081  void accept(visitor::Visitor& v) override;
37082 
37083  /**
37084  * \copydoc accept(visitor::Visitor&)
37085  */
37086  void accept(visitor::ConstVisitor& v) const override;
37087 
37088  /// \}
37089 
37090 
37091 
37092  private:
37093  /**
37094  * \brief Set this object as parent for all the children
37095  *
37096  * This should be called in every object (with children) constructor
37097  * to set parents. Since it is called only in the constructors it
37098  * should not be virtual to avoid ambiguities (issue #295).
37099  */
37100  void set_parent_in_children();
37101 };
37102 
37103 /** @} */ // end of ast_class
37104 
37105 
37106 } // namespace ast
37107 } // namespace nmodl
37108 #endif // !NMODL_AST_PROGRAM_HPP
37109 #ifndef NMODL_AST_NRN_STATE_BLOCK_HPP
37110 #define NMODL_AST_NRN_STATE_BLOCK_HPP
37111 
37112 
37113 namespace nmodl {
37114 namespace ast {
37115 
37116 /**
37117  * @addtogroup ast_class
37118  * @ingroup ast
37119  * @{
37120  */
37121 
37122 /**
37123  * \brief Represents the coreneuron nrn_state callback function
37124  *
37125  *
37126 */
37127 class NrnStateBlock : public Block {
37128  private:
37129  /// solve blocks to be called or generated
37131  /// token with location information
37132  std::shared_ptr<ModToken> token;
37133  /// symbol table for a block
37134  symtab::SymbolTable* symtab = nullptr;
37135 
37136  public:
37137 
37138  /// \name Ctor & dtor
37139  /// \{
37140 
37141  explicit NrnStateBlock(StatementVector solve_statements);
37142  NrnStateBlock(const NrnStateBlock& obj);
37143 
37144 
37145  virtual ~NrnStateBlock() = default;
37146 
37147  /// \}
37148 
37149 
37150 
37151 
37152 
37153 
37154  /**
37155  * \brief Check if the ast node is an instance of ast::NrnStateBlock
37156  * \return true as object is of type ast::NrnStateBlock
37157  */
37158  bool is_nrn_state_block () const noexcept override {
37159  return true;
37160  }
37161 
37162  /**
37163  * \brief Return a copy of the current node
37164  *
37165  * Recursively make a new copy/clone of the current node including
37166  * all members and return a pointer to the node. This is used for
37167  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
37168  * ast.
37169  *
37170  * @return pointer to the clone/copy of the current node
37171  */
37172  NrnStateBlock* clone() const override {
37173  return new NrnStateBlock(*this);
37174  }
37175 
37176  /// \name Getters
37177  /// \{
37178 
37179  /**
37180  * \brief Return type (ast::AstNodeType) of ast node
37181  *
37182  * Every node in the ast has a type defined in ast::AstNodeType and this
37183  * function is used to retrieve the same.
37184  *
37185  * \return ast node type i.e. ast::AstNodeType::NRN_STATE_BLOCK
37186  *
37187  * \sa Ast::get_node_type_name
37188  */
37189  AstNodeType get_node_type() const noexcept override {
37191  }
37192 
37193  /**
37194  * \brief Return type (ast::AstNodeType) of ast node as std::string
37195  *
37196  * Every node in the ast has a type defined in ast::AstNodeType.
37197  * This type name can be returned as a std::string for printing
37198  * node to text/json form.
37199  *
37200  * \return name of the node type as a string i.e. "NrnStateBlock"
37201  *
37202  * \sa Ast::get_node_name
37203  */
37204  std::string get_node_type_name() const noexcept override {
37205  return "NrnStateBlock";
37206  }
37207 
37208  /**
37209  * \brief Return NMODL statement of ast node as std::string
37210  *
37211  * Every node is related to a special statement in the NMODL. This
37212  * statement can be returned as a std::string for printing to
37213  * text/json form.
37214  *
37215  * \return name of the statement as a string i.e. "NRN_STATE "
37216  *
37217  * \sa Ast::get_nmodl_name
37218  */
37219  std::string get_nmodl_name() const noexcept override {
37220  return "NRN_STATE ";
37221  }
37222 
37223  /**
37224  * \brief Get std::shared_ptr from `this` pointer of the current ast node
37225  */
37226  std::shared_ptr<Ast> get_shared_ptr() override {
37227  return std::static_pointer_cast<NrnStateBlock>(shared_from_this());
37228  }
37229 
37230  /**
37231  * \brief Get std::shared_ptr from `this` pointer of the current ast node
37232  */
37233  std::shared_ptr<const Ast> get_shared_ptr() const override {
37234  return std::static_pointer_cast<const NrnStateBlock>(shared_from_this());
37235  }
37236 
37237  /**
37238  * \brief Return associated token for the current ast node
37239  *
37240  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
37241  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
37242  * nullptr to store in the nmodl::symtab::SymbolTable.
37243  *
37244  * \return pointer to token if exist otherwise nullptr
37245  */
37246  const ModToken* get_token() const noexcept override {
37247  return token.get();
37248  }
37249 
37250  /**
37251  * \brief Return associated symbol table for the current ast node
37252  *
37253  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
37254  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
37255  * and it can be accessed using this method.
37256  *
37257  * \return pointer to the symbol table
37258  *
37259  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
37260  */
37262  return symtab;
37263  }
37264 
37265 
37266 
37267 
37268 
37269 
37270 
37271 
37272  /**
37273  * \brief Getter for member variable \ref NrnStateBlock.solve_statements
37274  */
37275  const StatementVector& get_solve_statements() const noexcept {
37276  return solve_statements;
37277  }
37278 
37279 
37280 
37281  /// \}
37282 
37283  /// \name Setters
37284  /// \{
37285 
37286 
37287  /**
37288  * \brief Set token for the current ast node
37289  */
37290  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
37291 
37292  /**
37293  * \brief Set symbol table for the current ast node
37294  *
37295  * Top level, block scoped nodes store symbol table in the ast node.
37296  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
37297  * for every node in the ast.
37298  *
37299  * \sa nmodl::visitor::SymtabVisitor
37300  */
37301  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
37302  symtab = newsymtab;
37303  }
37304 
37305 
37306 
37307  /**
37308  * \brief Setter for member variable \ref NrnStateBlock.solve_statements (rvalue reference)
37309  */
37310  void set_solve_statements(StatementVector&& solve_statements);
37311 
37312  /**
37313  * \brief Setter for member variable \ref NrnStateBlock.solve_statements
37314  */
37315  void set_solve_statements(const StatementVector& solve_statements);
37316 
37317 
37318  /// \}
37319 
37320  /// \name Visitor
37321  /// \{
37322 
37323  /**
37324  * \brief visit children i.e. member variables of current node using provided visitor
37325  *
37326  * Different nodes in the AST have different members (i.e. children). This method
37327  * recursively visits children using provided visitor.
37328  *
37329  * \param v Concrete visitor that will be used to recursively visit children
37330  *
37331  * \sa Ast::visit_children for example.
37332  */
37333  void visit_children(visitor::Visitor& v) override;
37334 
37335  /**
37336  * \brief visit children i.e. member variables of current node using provided visitor
37337  *
37338  * Different nodes in the AST have different members (i.e. children). This method
37339  * recursively visits children using provided visitor.
37340  *
37341  * \param v Concrete constant visitor that will be used to recursively visit children
37342  *
37343  * \sa Ast::visit_children for example.
37344  */
37345  void visit_children(visitor::ConstVisitor& v) const override;
37346 
37347  /**
37348  * \brief accept (or visit) the current AST node using provided visitor
37349  *
37350  * Instead of visiting children of AST node, like Ast::visit_children,
37351  * accept allows to visit the current node itself using provided concrete
37352  * visitor.
37353  *
37354  * \param v Concrete visitor that will be used to recursively visit node
37355  *
37356  * \sa Ast::accept for example.
37357  */
37358  void accept(visitor::Visitor& v) override;
37359 
37360  /**
37361  * \copydoc accept(visitor::Visitor&)
37362  */
37363  void accept(visitor::ConstVisitor& v) const override;
37364 
37365  /// \}
37366 
37367 
37368 
37369  private:
37370  /**
37371  * \brief Set this object as parent for all the children
37372  *
37373  * This should be called in every object (with children) constructor
37374  * to set parents. Since it is called only in the constructors it
37375  * should not be virtual to avoid ambiguities (issue #295).
37376  */
37377  void set_parent_in_children();
37378 };
37379 
37380 /** @} */ // end of ast_class
37381 
37382 
37383 } // namespace ast
37384 } // namespace nmodl
37385 #endif // !NMODL_AST_NRN_STATE_BLOCK_HPP
37386 #ifndef NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
37387 #define NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
37388 
37389 
37390 namespace nmodl {
37391 namespace ast {
37392 
37393 /**
37394  * @addtogroup ast_class
37395  * @ingroup ast
37396  * @{
37397  */
37398 
37399 /**
37400  * \brief Represent newton solver solution block based on Eigen
37401  *
37402  *
37403 */
37405  private:
37406  /// number of state vars used in solve
37407  std::shared_ptr<Integer> n_state_vars;
37408  /// Statements to be declared in the functor
37409  std::shared_ptr<StatementBlock> variable_block;
37410  /// Statement block to be executed before calling newton solver
37411  std::shared_ptr<StatementBlock> initialize_block;
37412  /// update X from states
37413  std::shared_ptr<StatementBlock> setup_x_block;
37414  /// odes as functor for eigen
37415  std::shared_ptr<StatementBlock> functor_block;
37416  /// update back states from X
37417  std::shared_ptr<StatementBlock> update_states_block;
37418  /// Statement block to be executed after calling newton solver
37419  std::shared_ptr<StatementBlock> finalize_block;
37420  /// token with location information
37421  std::shared_ptr<ModToken> token;
37422  /// symbol table for a block
37423  symtab::SymbolTable* symtab = nullptr;
37424 
37425  public:
37426 
37427  /// \name Ctor & dtor
37428  /// \{
37429 
37430  explicit EigenNewtonSolverBlock(Integer* n_state_vars, StatementBlock* variable_block, StatementBlock* initialize_block, StatementBlock* setup_x_block, StatementBlock* functor_block, StatementBlock* update_states_block, StatementBlock* finalize_block);
37431  explicit EigenNewtonSolverBlock(const std::shared_ptr<Integer>& n_state_vars, const std::shared_ptr<StatementBlock>& variable_block, const std::shared_ptr<StatementBlock>& initialize_block, const std::shared_ptr<StatementBlock>& setup_x_block, const std::shared_ptr<StatementBlock>& functor_block, const std::shared_ptr<StatementBlock>& update_states_block, const std::shared_ptr<StatementBlock>& finalize_block);
37433 
37434 
37435  virtual ~EigenNewtonSolverBlock() = default;
37436 
37437  /// \}
37438 
37439 
37440 
37441 
37442 
37443 
37444  /**
37445  * \brief Check if the ast node is an instance of ast::EigenNewtonSolverBlock
37446  * \return true as object is of type ast::EigenNewtonSolverBlock
37447  */
37448  bool is_eigen_newton_solver_block () const noexcept override {
37449  return true;
37450  }
37451 
37452  /**
37453  * \brief Return a copy of the current node
37454  *
37455  * Recursively make a new copy/clone of the current node including
37456  * all members and return a pointer to the node. This is used for
37457  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
37458  * ast.
37459  *
37460  * @return pointer to the clone/copy of the current node
37461  */
37462  EigenNewtonSolverBlock* clone() const override {
37463  return new EigenNewtonSolverBlock(*this);
37464  }
37465 
37466  /// \name Getters
37467  /// \{
37468 
37469  /**
37470  * \brief Return type (ast::AstNodeType) of ast node
37471  *
37472  * Every node in the ast has a type defined in ast::AstNodeType and this
37473  * function is used to retrieve the same.
37474  *
37475  * \return ast node type i.e. ast::AstNodeType::EIGEN_NEWTON_SOLVER_BLOCK
37476  *
37477  * \sa Ast::get_node_type_name
37478  */
37479  AstNodeType get_node_type() const noexcept override {
37481  }
37482 
37483  /**
37484  * \brief Return type (ast::AstNodeType) of ast node as std::string
37485  *
37486  * Every node in the ast has a type defined in ast::AstNodeType.
37487  * This type name can be returned as a std::string for printing
37488  * node to text/json form.
37489  *
37490  * \return name of the node type as a string i.e. "EigenNewtonSolverBlock"
37491  *
37492  * \sa Ast::get_node_name
37493  */
37494  std::string get_node_type_name() const noexcept override {
37495  return "EigenNewtonSolverBlock";
37496  }
37497 
37498  /**
37499  * \brief Return NMODL statement of ast node as std::string
37500  *
37501  * Every node is related to a special statement in the NMODL. This
37502  * statement can be returned as a std::string for printing to
37503  * text/json form.
37504  *
37505  * \return name of the statement as a string i.e. "EIGEN_NEWTON_SOLVE"
37506  *
37507  * \sa Ast::get_nmodl_name
37508  */
37509  std::string get_nmodl_name() const noexcept override {
37510  return "EIGEN_NEWTON_SOLVE";
37511  }
37512 
37513  /**
37514  * \brief Get std::shared_ptr from `this` pointer of the current ast node
37515  */
37516  std::shared_ptr<Ast> get_shared_ptr() override {
37517  return std::static_pointer_cast<EigenNewtonSolverBlock>(shared_from_this());
37518  }
37519 
37520  /**
37521  * \brief Get std::shared_ptr from `this` pointer of the current ast node
37522  */
37523  std::shared_ptr<const Ast> get_shared_ptr() const override {
37524  return std::static_pointer_cast<const EigenNewtonSolverBlock>(shared_from_this());
37525  }
37526 
37527  /**
37528  * \brief Return associated token for the current ast node
37529  *
37530  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
37531  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
37532  * nullptr to store in the nmodl::symtab::SymbolTable.
37533  *
37534  * \return pointer to token if exist otherwise nullptr
37535  */
37536  const ModToken* get_token() const noexcept override {
37537  return token.get();
37538  }
37539 
37540  /**
37541  * \brief Return associated symbol table for the current ast node
37542  *
37543  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
37544  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
37545  * and it can be accessed using this method.
37546  *
37547  * \return pointer to the symbol table
37548  *
37549  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
37550  */
37552  return symtab;
37553  }
37554 
37555 
37556 
37557 
37558 
37559 
37560 
37561 
37562  /**
37563  * \brief Getter for member variable \ref EigenNewtonSolverBlock.n_state_vars
37564  */
37565  const std::shared_ptr<Integer>& get_n_state_vars() const noexcept {
37566  return n_state_vars;
37567  }
37568 
37569 
37570 
37571 
37572 
37573 
37574 
37575  /**
37576  * \brief Getter for member variable \ref EigenNewtonSolverBlock.variable_block
37577  */
37578  const std::shared_ptr<StatementBlock>& get_variable_block() const noexcept {
37579  return variable_block;
37580  }
37581 
37582 
37583 
37584 
37585 
37586 
37587 
37588  /**
37589  * \brief Getter for member variable \ref EigenNewtonSolverBlock.initialize_block
37590  */
37591  const std::shared_ptr<StatementBlock>& get_initialize_block() const noexcept {
37592  return initialize_block;
37593  }
37594 
37595 
37596 
37597 
37598 
37599 
37600 
37601  /**
37602  * \brief Getter for member variable \ref EigenNewtonSolverBlock.setup_x_block
37603  */
37604  const std::shared_ptr<StatementBlock>& get_setup_x_block() const noexcept {
37605  return setup_x_block;
37606  }
37607 
37608 
37609 
37610 
37611 
37612 
37613 
37614  /**
37615  * \brief Getter for member variable \ref EigenNewtonSolverBlock.functor_block
37616  */
37617  const std::shared_ptr<StatementBlock>& get_functor_block() const noexcept {
37618  return functor_block;
37619  }
37620 
37621 
37622 
37623 
37624 
37625 
37626 
37627  /**
37628  * \brief Getter for member variable \ref EigenNewtonSolverBlock.update_states_block
37629  */
37630  const std::shared_ptr<StatementBlock>& get_update_states_block() const noexcept {
37631  return update_states_block;
37632  }
37633 
37634 
37635 
37636 
37637 
37638 
37639 
37640  /**
37641  * \brief Getter for member variable \ref EigenNewtonSolverBlock.finalize_block
37642  */
37643  const std::shared_ptr<StatementBlock>& get_finalize_block() const noexcept {
37644  return finalize_block;
37645  }
37646 
37647 
37648 
37649  /// \}
37650 
37651  /// \name Setters
37652  /// \{
37653 
37654 
37655  /**
37656  * \brief Set token for the current ast node
37657  */
37658  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
37659 
37660  /**
37661  * \brief Set symbol table for the current ast node
37662  *
37663  * Top level, block scoped nodes store symbol table in the ast node.
37664  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
37665  * for every node in the ast.
37666  *
37667  * \sa nmodl::visitor::SymtabVisitor
37668  */
37669  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
37670  symtab = newsymtab;
37671  }
37672 
37673 
37674 
37675  /**
37676  * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars (rvalue reference)
37677  */
37678  void set_n_state_vars(std::shared_ptr<Integer>&& n_state_vars);
37679 
37680  /**
37681  * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars
37682  */
37683  void set_n_state_vars(const std::shared_ptr<Integer>& n_state_vars);
37684 
37685 
37686  /**
37687  * \brief Setter for member variable \ref EigenNewtonSolverBlock.variable_block (rvalue reference)
37688  */
37689  void set_variable_block(std::shared_ptr<StatementBlock>&& variable_block);
37690 
37691  /**
37692  * \brief Setter for member variable \ref EigenNewtonSolverBlock.variable_block
37693  */
37694  void set_variable_block(const std::shared_ptr<StatementBlock>& variable_block);
37695 
37696 
37697  /**
37698  * \brief Setter for member variable \ref EigenNewtonSolverBlock.initialize_block (rvalue reference)
37699  */
37700  void set_initialize_block(std::shared_ptr<StatementBlock>&& initialize_block);
37701 
37702  /**
37703  * \brief Setter for member variable \ref EigenNewtonSolverBlock.initialize_block
37704  */
37705  void set_initialize_block(const std::shared_ptr<StatementBlock>& initialize_block);
37706 
37707 
37708  /**
37709  * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block (rvalue reference)
37710  */
37711  void set_setup_x_block(std::shared_ptr<StatementBlock>&& setup_x_block);
37712 
37713  /**
37714  * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block
37715  */
37716  void set_setup_x_block(const std::shared_ptr<StatementBlock>& setup_x_block);
37717 
37718 
37719  /**
37720  * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block (rvalue reference)
37721  */
37722  void set_functor_block(std::shared_ptr<StatementBlock>&& functor_block);
37723 
37724  /**
37725  * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block
37726  */
37727  void set_functor_block(const std::shared_ptr<StatementBlock>& functor_block);
37728 
37729 
37730  /**
37731  * \brief Setter for member variable \ref EigenNewtonSolverBlock.update_states_block (rvalue reference)
37732  */
37733  void set_update_states_block(std::shared_ptr<StatementBlock>&& update_states_block);
37734 
37735  /**
37736  * \brief Setter for member variable \ref EigenNewtonSolverBlock.update_states_block
37737  */
37738  void set_update_states_block(const std::shared_ptr<StatementBlock>& update_states_block);
37739 
37740 
37741  /**
37742  * \brief Setter for member variable \ref EigenNewtonSolverBlock.finalize_block (rvalue reference)
37743  */
37744  void set_finalize_block(std::shared_ptr<StatementBlock>&& finalize_block);
37745 
37746  /**
37747  * \brief Setter for member variable \ref EigenNewtonSolverBlock.finalize_block
37748  */
37749  void set_finalize_block(const std::shared_ptr<StatementBlock>& finalize_block);
37750 
37751 
37752  /// \}
37753 
37754  /// \name Visitor
37755  /// \{
37756 
37757  /**
37758  * \brief visit children i.e. member variables of current node using provided visitor
37759  *
37760  * Different nodes in the AST have different members (i.e. children). This method
37761  * recursively visits children using provided visitor.
37762  *
37763  * \param v Concrete visitor that will be used to recursively visit children
37764  *
37765  * \sa Ast::visit_children for example.
37766  */
37767  void visit_children(visitor::Visitor& v) override;
37768 
37769  /**
37770  * \brief visit children i.e. member variables of current node using provided visitor
37771  *
37772  * Different nodes in the AST have different members (i.e. children). This method
37773  * recursively visits children using provided visitor.
37774  *
37775  * \param v Concrete constant visitor that will be used to recursively visit children
37776  *
37777  * \sa Ast::visit_children for example.
37778  */
37779  void visit_children(visitor::ConstVisitor& v) const override;
37780 
37781  /**
37782  * \brief accept (or visit) the current AST node using provided visitor
37783  *
37784  * Instead of visiting children of AST node, like Ast::visit_children,
37785  * accept allows to visit the current node itself using provided concrete
37786  * visitor.
37787  *
37788  * \param v Concrete visitor that will be used to recursively visit node
37789  *
37790  * \sa Ast::accept for example.
37791  */
37792  void accept(visitor::Visitor& v) override;
37793 
37794  /**
37795  * \copydoc accept(visitor::Visitor&)
37796  */
37797  void accept(visitor::ConstVisitor& v) const override;
37798 
37799  /// \}
37800 
37801 
37802 
37803  private:
37804  /**
37805  * \brief Set this object as parent for all the children
37806  *
37807  * This should be called in every object (with children) constructor
37808  * to set parents. Since it is called only in the constructors it
37809  * should not be virtual to avoid ambiguities (issue #295).
37810  */
37811  void set_parent_in_children();
37812 };
37813 
37814 /** @} */ // end of ast_class
37815 
37816 
37817 } // namespace ast
37818 } // namespace nmodl
37819 #endif // !NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
37820 #ifndef NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
37821 #define NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
37822 
37823 
37824 namespace nmodl {
37825 namespace ast {
37826 
37827 /**
37828  * @addtogroup ast_class
37829  * @ingroup ast
37830  * @{
37831  */
37832 
37833 /**
37834  * \brief Represent linear solver solution block based on Eigen
37835  *
37836  *
37837 */
37839  private:
37840  /// number of state vars used in solve
37841  std::shared_ptr<Integer> n_state_vars;
37842  /// Statements to be declared in the functor
37843  std::shared_ptr<StatementBlock> variable_block;
37844  /// Statement block to be executed before calling linear solver
37845  std::shared_ptr<StatementBlock> initialize_block;
37846  /// update X from states
37847  std::shared_ptr<StatementBlock> setup_x_block;
37848  /// update back states from X
37849  std::shared_ptr<StatementBlock> update_states_block;
37850  /// Statement block to be executed after calling linear solver
37851  std::shared_ptr<StatementBlock> finalize_block;
37852  /// token with location information
37853  std::shared_ptr<ModToken> token;
37854  /// symbol table for a block
37855  symtab::SymbolTable* symtab = nullptr;
37856 
37857  public:
37858 
37859  /// \name Ctor & dtor
37860  /// \{
37861 
37862  explicit EigenLinearSolverBlock(Integer* n_state_vars, StatementBlock* variable_block, StatementBlock* initialize_block, StatementBlock* setup_x_block, StatementBlock* update_states_block, StatementBlock* finalize_block);
37863  explicit EigenLinearSolverBlock(const std::shared_ptr<Integer>& n_state_vars, const std::shared_ptr<StatementBlock>& variable_block, const std::shared_ptr<StatementBlock>& initialize_block, const std::shared_ptr<StatementBlock>& setup_x_block, const std::shared_ptr<StatementBlock>& update_states_block, const std::shared_ptr<StatementBlock>& finalize_block);
37865 
37866 
37867  virtual ~EigenLinearSolverBlock() = default;
37868 
37869  /// \}
37870 
37871 
37872 
37873 
37874 
37875 
37876  /**
37877  * \brief Check if the ast node is an instance of ast::EigenLinearSolverBlock
37878  * \return true as object is of type ast::EigenLinearSolverBlock
37879  */
37880  bool is_eigen_linear_solver_block () const noexcept override {
37881  return true;
37882  }
37883 
37884  /**
37885  * \brief Return a copy of the current node
37886  *
37887  * Recursively make a new copy/clone of the current node including
37888  * all members and return a pointer to the node. This is used for
37889  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
37890  * ast.
37891  *
37892  * @return pointer to the clone/copy of the current node
37893  */
37894  EigenLinearSolverBlock* clone() const override {
37895  return new EigenLinearSolverBlock(*this);
37896  }
37897 
37898  /// \name Getters
37899  /// \{
37900 
37901  /**
37902  * \brief Return type (ast::AstNodeType) of ast node
37903  *
37904  * Every node in the ast has a type defined in ast::AstNodeType and this
37905  * function is used to retrieve the same.
37906  *
37907  * \return ast node type i.e. ast::AstNodeType::EIGEN_LINEAR_SOLVER_BLOCK
37908  *
37909  * \sa Ast::get_node_type_name
37910  */
37911  AstNodeType get_node_type() const noexcept override {
37913  }
37914 
37915  /**
37916  * \brief Return type (ast::AstNodeType) of ast node as std::string
37917  *
37918  * Every node in the ast has a type defined in ast::AstNodeType.
37919  * This type name can be returned as a std::string for printing
37920  * node to text/json form.
37921  *
37922  * \return name of the node type as a string i.e. "EigenLinearSolverBlock"
37923  *
37924  * \sa Ast::get_node_name
37925  */
37926  std::string get_node_type_name() const noexcept override {
37927  return "EigenLinearSolverBlock";
37928  }
37929 
37930  /**
37931  * \brief Return NMODL statement of ast node as std::string
37932  *
37933  * Every node is related to a special statement in the NMODL. This
37934  * statement can be returned as a std::string for printing to
37935  * text/json form.
37936  *
37937  * \return name of the statement as a string i.e. "EIGEN_LINEAR_SOLVE"
37938  *
37939  * \sa Ast::get_nmodl_name
37940  */
37941  std::string get_nmodl_name() const noexcept override {
37942  return "EIGEN_LINEAR_SOLVE";
37943  }
37944 
37945  /**
37946  * \brief Get std::shared_ptr from `this` pointer of the current ast node
37947  */
37948  std::shared_ptr<Ast> get_shared_ptr() override {
37949  return std::static_pointer_cast<EigenLinearSolverBlock>(shared_from_this());
37950  }
37951 
37952  /**
37953  * \brief Get std::shared_ptr from `this` pointer of the current ast node
37954  */
37955  std::shared_ptr<const Ast> get_shared_ptr() const override {
37956  return std::static_pointer_cast<const EigenLinearSolverBlock>(shared_from_this());
37957  }
37958 
37959  /**
37960  * \brief Return associated token for the current ast node
37961  *
37962  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
37963  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
37964  * nullptr to store in the nmodl::symtab::SymbolTable.
37965  *
37966  * \return pointer to token if exist otherwise nullptr
37967  */
37968  const ModToken* get_token() const noexcept override {
37969  return token.get();
37970  }
37971 
37972  /**
37973  * \brief Return associated symbol table for the current ast node
37974  *
37975  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
37976  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
37977  * and it can be accessed using this method.
37978  *
37979  * \return pointer to the symbol table
37980  *
37981  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
37982  */
37984  return symtab;
37985  }
37986 
37987 
37988 
37989 
37990 
37991 
37992 
37993 
37994  /**
37995  * \brief Getter for member variable \ref EigenLinearSolverBlock.n_state_vars
37996  */
37997  const std::shared_ptr<Integer>& get_n_state_vars() const noexcept {
37998  return n_state_vars;
37999  }
38000 
38001 
38002 
38003 
38004 
38005 
38006 
38007  /**
38008  * \brief Getter for member variable \ref EigenLinearSolverBlock.variable_block
38009  */
38010  const std::shared_ptr<StatementBlock>& get_variable_block() const noexcept {
38011  return variable_block;
38012  }
38013 
38014 
38015 
38016 
38017 
38018 
38019 
38020  /**
38021  * \brief Getter for member variable \ref EigenLinearSolverBlock.initialize_block
38022  */
38023  const std::shared_ptr<StatementBlock>& get_initialize_block() const noexcept {
38024  return initialize_block;
38025  }
38026 
38027 
38028 
38029 
38030 
38031 
38032 
38033  /**
38034  * \brief Getter for member variable \ref EigenLinearSolverBlock.setup_x_block
38035  */
38036  const std::shared_ptr<StatementBlock>& get_setup_x_block() const noexcept {
38037  return setup_x_block;
38038  }
38039 
38040 
38041 
38042 
38043 
38044 
38045 
38046  /**
38047  * \brief Getter for member variable \ref EigenLinearSolverBlock.update_states_block
38048  */
38049  const std::shared_ptr<StatementBlock>& get_update_states_block() const noexcept {
38050  return update_states_block;
38051  }
38052 
38053 
38054 
38055 
38056 
38057 
38058 
38059  /**
38060  * \brief Getter for member variable \ref EigenLinearSolverBlock.finalize_block
38061  */
38062  const std::shared_ptr<StatementBlock>& get_finalize_block() const noexcept {
38063  return finalize_block;
38064  }
38065 
38066 
38067 
38068  /// \}
38069 
38070  /// \name Setters
38071  /// \{
38072 
38073 
38074  /**
38075  * \brief Set token for the current ast node
38076  */
38077  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
38078 
38079  /**
38080  * \brief Set symbol table for the current ast node
38081  *
38082  * Top level, block scoped nodes store symbol table in the ast node.
38083  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
38084  * for every node in the ast.
38085  *
38086  * \sa nmodl::visitor::SymtabVisitor
38087  */
38088  void set_symbol_table(symtab::SymbolTable* newsymtab) override {
38089  symtab = newsymtab;
38090  }
38091 
38092 
38093 
38094  /**
38095  * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars (rvalue reference)
38096  */
38097  void set_n_state_vars(std::shared_ptr<Integer>&& n_state_vars);
38098 
38099  /**
38100  * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars
38101  */
38102  void set_n_state_vars(const std::shared_ptr<Integer>& n_state_vars);
38103 
38104 
38105  /**
38106  * \brief Setter for member variable \ref EigenLinearSolverBlock.variable_block (rvalue reference)
38107  */
38108  void set_variable_block(std::shared_ptr<StatementBlock>&& variable_block);
38109 
38110  /**
38111  * \brief Setter for member variable \ref EigenLinearSolverBlock.variable_block
38112  */
38113  void set_variable_block(const std::shared_ptr<StatementBlock>& variable_block);
38114 
38115 
38116  /**
38117  * \brief Setter for member variable \ref EigenLinearSolverBlock.initialize_block (rvalue reference)
38118  */
38119  void set_initialize_block(std::shared_ptr<StatementBlock>&& initialize_block);
38120 
38121  /**
38122  * \brief Setter for member variable \ref EigenLinearSolverBlock.initialize_block
38123  */
38124  void set_initialize_block(const std::shared_ptr<StatementBlock>& initialize_block);
38125 
38126 
38127  /**
38128  * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block (rvalue reference)
38129  */
38130  void set_setup_x_block(std::shared_ptr<StatementBlock>&& setup_x_block);
38131 
38132  /**
38133  * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block
38134  */
38135  void set_setup_x_block(const std::shared_ptr<StatementBlock>& setup_x_block);
38136 
38137 
38138  /**
38139  * \brief Setter for member variable \ref EigenLinearSolverBlock.update_states_block (rvalue reference)
38140  */
38141  void set_update_states_block(std::shared_ptr<StatementBlock>&& update_states_block);
38142 
38143  /**
38144  * \brief Setter for member variable \ref EigenLinearSolverBlock.update_states_block
38145  */
38146  void set_update_states_block(const std::shared_ptr<StatementBlock>& update_states_block);
38147 
38148 
38149  /**
38150  * \brief Setter for member variable \ref EigenLinearSolverBlock.finalize_block (rvalue reference)
38151  */
38152  void set_finalize_block(std::shared_ptr<StatementBlock>&& finalize_block);
38153 
38154  /**
38155  * \brief Setter for member variable \ref EigenLinearSolverBlock.finalize_block
38156  */
38157  void set_finalize_block(const std::shared_ptr<StatementBlock>& finalize_block);
38158 
38159 
38160  /// \}
38161 
38162  /// \name Visitor
38163  /// \{
38164 
38165  /**
38166  * \brief visit children i.e. member variables of current node using provided visitor
38167  *
38168  * Different nodes in the AST have different members (i.e. children). This method
38169  * recursively visits children using provided visitor.
38170  *
38171  * \param v Concrete visitor that will be used to recursively visit children
38172  *
38173  * \sa Ast::visit_children for example.
38174  */
38175  void visit_children(visitor::Visitor& v) override;
38176 
38177  /**
38178  * \brief visit children i.e. member variables of current node using provided visitor
38179  *
38180  * Different nodes in the AST have different members (i.e. children). This method
38181  * recursively visits children using provided visitor.
38182  *
38183  * \param v Concrete constant visitor that will be used to recursively visit children
38184  *
38185  * \sa Ast::visit_children for example.
38186  */
38187  void visit_children(visitor::ConstVisitor& v) const override;
38188 
38189  /**
38190  * \brief accept (or visit) the current AST node using provided visitor
38191  *
38192  * Instead of visiting children of AST node, like Ast::visit_children,
38193  * accept allows to visit the current node itself using provided concrete
38194  * visitor.
38195  *
38196  * \param v Concrete visitor that will be used to recursively visit node
38197  *
38198  * \sa Ast::accept for example.
38199  */
38200  void accept(visitor::Visitor& v) override;
38201 
38202  /**
38203  * \copydoc accept(visitor::Visitor&)
38204  */
38205  void accept(visitor::ConstVisitor& v) const override;
38206 
38207  /// \}
38208 
38209 
38210 
38211  private:
38212  /**
38213  * \brief Set this object as parent for all the children
38214  *
38215  * This should be called in every object (with children) constructor
38216  * to set parents. Since it is called only in the constructors it
38217  * should not be virtual to avoid ambiguities (issue #295).
38218  */
38219  void set_parent_in_children();
38220 };
38221 
38222 /** @} */ // end of ast_class
38223 
38224 
38225 } // namespace ast
38226 } // namespace nmodl
38227 #endif // !NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
38228 #ifndef NMODL_AST_WRAPPED_EXPRESSION_HPP
38229 #define NMODL_AST_WRAPPED_EXPRESSION_HPP
38230 
38231 
38232 namespace nmodl {
38233 namespace ast {
38234 
38235 /**
38236  * @addtogroup ast_class
38237  * @ingroup ast
38238  * @{
38239  */
38240 
38241 /**
38242  * \brief Wrap any other expression type
38243  *
38244  *
38245 */
38247  private:
38248  /// Expression that is being wrapped
38249  std::shared_ptr<Expression> expression;
38250  /// token with location information
38251  std::shared_ptr<ModToken> token;
38252 
38253  public:
38254 
38255  /// \name Ctor & dtor
38256  /// \{
38257 
38258  explicit WrappedExpression(Expression* expression);
38259  explicit WrappedExpression(const std::shared_ptr<Expression>& expression);
38261 
38262 
38263  virtual ~WrappedExpression() = default;
38264 
38265  /// \}
38266 
38267 
38268 
38269 
38270 
38271 
38272  /**
38273  * \brief Check if the ast node is an instance of ast::WrappedExpression
38274  * \return true as object is of type ast::WrappedExpression
38275  */
38276  bool is_wrapped_expression () const noexcept override {
38277  return true;
38278  }
38279 
38280  /**
38281  * \brief Return a copy of the current node
38282  *
38283  * Recursively make a new copy/clone of the current node including
38284  * all members and return a pointer to the node. This is used for
38285  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
38286  * ast.
38287  *
38288  * @return pointer to the clone/copy of the current node
38289  */
38290  WrappedExpression* clone() const override {
38291  return new WrappedExpression(*this);
38292  }
38293 
38294  /// \name Getters
38295  /// \{
38296 
38297  /**
38298  * \brief Return type (ast::AstNodeType) of ast node
38299  *
38300  * Every node in the ast has a type defined in ast::AstNodeType and this
38301  * function is used to retrieve the same.
38302  *
38303  * \return ast node type i.e. ast::AstNodeType::WRAPPED_EXPRESSION
38304  *
38305  * \sa Ast::get_node_type_name
38306  */
38307  AstNodeType get_node_type() const noexcept override {
38309  }
38310 
38311  /**
38312  * \brief Return type (ast::AstNodeType) of ast node as std::string
38313  *
38314  * Every node in the ast has a type defined in ast::AstNodeType.
38315  * This type name can be returned as a std::string for printing
38316  * node to text/json form.
38317  *
38318  * \return name of the node type as a string i.e. "WrappedExpression"
38319  *
38320  * \sa Ast::get_node_name
38321  */
38322  std::string get_node_type_name() const noexcept override {
38323  return "WrappedExpression";
38324  }
38325 
38326 
38327  /**
38328  * \brief Get std::shared_ptr from `this` pointer of the current ast node
38329  */
38330  std::shared_ptr<Ast> get_shared_ptr() override {
38331  return std::static_pointer_cast<WrappedExpression>(shared_from_this());
38332  }
38333 
38334  /**
38335  * \brief Get std::shared_ptr from `this` pointer of the current ast node
38336  */
38337  std::shared_ptr<const Ast> get_shared_ptr() const override {
38338  return std::static_pointer_cast<const WrappedExpression>(shared_from_this());
38339  }
38340 
38341  /**
38342  * \brief Return associated token for the current ast node
38343  *
38344  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
38345  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
38346  * nullptr to store in the nmodl::symtab::SymbolTable.
38347  *
38348  * \return pointer to token if exist otherwise nullptr
38349  */
38350  const ModToken* get_token() const noexcept override {
38351  return token.get();
38352  }
38353 
38354 
38355 
38356 
38357 
38358 
38359 
38360 
38361  /**
38362  * \brief Getter for member variable \ref WrappedExpression.expression
38363  */
38364  const std::shared_ptr<Expression>& get_expression() const noexcept {
38365  return expression;
38366  }
38367 
38368 
38369 
38370  /// \}
38371 
38372  /// \name Setters
38373  /// \{
38374 
38375 
38376  /**
38377  * \brief Set token for the current ast node
38378  */
38379  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
38380 
38381 
38382 
38383 
38384  /**
38385  * \brief Setter for member variable \ref WrappedExpression.expression (rvalue reference)
38386  */
38387  void set_expression(std::shared_ptr<Expression>&& expression);
38388 
38389  /**
38390  * \brief Setter for member variable \ref WrappedExpression.expression
38391  */
38392  void set_expression(const std::shared_ptr<Expression>& expression);
38393 
38394 
38395  /// \}
38396 
38397  /// \name Visitor
38398  /// \{
38399 
38400  /**
38401  * \brief visit children i.e. member variables of current node using provided visitor
38402  *
38403  * Different nodes in the AST have different members (i.e. children). This method
38404  * recursively visits children using provided visitor.
38405  *
38406  * \param v Concrete visitor that will be used to recursively visit children
38407  *
38408  * \sa Ast::visit_children for example.
38409  */
38410  void visit_children(visitor::Visitor& v) override;
38411 
38412  /**
38413  * \brief visit children i.e. member variables of current node using provided visitor
38414  *
38415  * Different nodes in the AST have different members (i.e. children). This method
38416  * recursively visits children using provided visitor.
38417  *
38418  * \param v Concrete constant visitor that will be used to recursively visit children
38419  *
38420  * \sa Ast::visit_children for example.
38421  */
38422  void visit_children(visitor::ConstVisitor& v) const override;
38423 
38424  /**
38425  * \brief accept (or visit) the current AST node using provided visitor
38426  *
38427  * Instead of visiting children of AST node, like Ast::visit_children,
38428  * accept allows to visit the current node itself using provided concrete
38429  * visitor.
38430  *
38431  * \param v Concrete visitor that will be used to recursively visit node
38432  *
38433  * \sa Ast::accept for example.
38434  */
38435  void accept(visitor::Visitor& v) override;
38436 
38437  /**
38438  * \copydoc accept(visitor::Visitor&)
38439  */
38440  void accept(visitor::ConstVisitor& v) const override;
38441 
38442  /// \}
38443 
38444 
38445 
38446  private:
38447  /**
38448  * \brief Set this object as parent for all the children
38449  *
38450  * This should be called in every object (with children) constructor
38451  * to set parents. Since it is called only in the constructors it
38452  * should not be virtual to avoid ambiguities (issue #295).
38453  */
38454  void set_parent_in_children();
38455 };
38456 
38457 /** @} */ // end of ast_class
38458 
38459 
38460 } // namespace ast
38461 } // namespace nmodl
38462 #endif // !NMODL_AST_WRAPPED_EXPRESSION_HPP
38463 #ifndef NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
38464 #define NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
38465 
38466 
38467 namespace nmodl {
38468 namespace ast {
38469 
38470 /**
38471  * @addtogroup ast_class
38472  * @ingroup ast
38473  * @{
38474  */
38475 
38476 /**
38477  * \brief Represent a callback to NEURON's derivimplicit solver
38478  *
38479  *
38480 */
38482  private:
38483  /// Block to be solved (typically derivative)
38484  std::shared_ptr<Block> node_to_solve;
38485  /// token with location information
38486  std::shared_ptr<ModToken> token;
38487 
38488  public:
38489 
38490  /// \name Ctor & dtor
38491  /// \{
38492 
38493  explicit DerivimplicitCallback(Block* node_to_solve);
38494  explicit DerivimplicitCallback(const std::shared_ptr<Block>& node_to_solve);
38496 
38497 
38498  virtual ~DerivimplicitCallback() = default;
38499 
38500  /// \}
38501 
38502 
38503 
38504 
38505 
38506 
38507  /**
38508  * \brief Check if the ast node is an instance of ast::DerivimplicitCallback
38509  * \return true as object is of type ast::DerivimplicitCallback
38510  */
38511  bool is_derivimplicit_callback () const noexcept override {
38512  return true;
38513  }
38514 
38515  /**
38516  * \brief Return a copy of the current node
38517  *
38518  * Recursively make a new copy/clone of the current node including
38519  * all members and return a pointer to the node. This is used for
38520  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
38521  * ast.
38522  *
38523  * @return pointer to the clone/copy of the current node
38524  */
38525  DerivimplicitCallback* clone() const override {
38526  return new DerivimplicitCallback(*this);
38527  }
38528 
38529  /// \name Getters
38530  /// \{
38531 
38532  /**
38533  * \brief Return type (ast::AstNodeType) of ast node
38534  *
38535  * Every node in the ast has a type defined in ast::AstNodeType and this
38536  * function is used to retrieve the same.
38537  *
38538  * \return ast node type i.e. ast::AstNodeType::DERIVIMPLICIT_CALLBACK
38539  *
38540  * \sa Ast::get_node_type_name
38541  */
38542  AstNodeType get_node_type() const noexcept override {
38544  }
38545 
38546  /**
38547  * \brief Return type (ast::AstNodeType) of ast node as std::string
38548  *
38549  * Every node in the ast has a type defined in ast::AstNodeType.
38550  * This type name can be returned as a std::string for printing
38551  * node to text/json form.
38552  *
38553  * \return name of the node type as a string i.e. "DerivimplicitCallback"
38554  *
38555  * \sa Ast::get_node_name
38556  */
38557  std::string get_node_type_name() const noexcept override {
38558  return "DerivimplicitCallback";
38559  }
38560 
38561 
38562  /**
38563  * \brief Get std::shared_ptr from `this` pointer of the current ast node
38564  */
38565  std::shared_ptr<Ast> get_shared_ptr() override {
38566  return std::static_pointer_cast<DerivimplicitCallback>(shared_from_this());
38567  }
38568 
38569  /**
38570  * \brief Get std::shared_ptr from `this` pointer of the current ast node
38571  */
38572  std::shared_ptr<const Ast> get_shared_ptr() const override {
38573  return std::static_pointer_cast<const DerivimplicitCallback>(shared_from_this());
38574  }
38575 
38576  /**
38577  * \brief Return associated token for the current ast node
38578  *
38579  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
38580  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
38581  * nullptr to store in the nmodl::symtab::SymbolTable.
38582  *
38583  * \return pointer to token if exist otherwise nullptr
38584  */
38585  const ModToken* get_token() const noexcept override {
38586  return token.get();
38587  }
38588 
38589 
38590 
38591 
38592 
38593 
38594 
38595 
38596  /**
38597  * \brief Getter for member variable \ref DerivimplicitCallback.node_to_solve
38598  */
38599  const std::shared_ptr<Block>& get_node_to_solve() const noexcept {
38600  return node_to_solve;
38601  }
38602 
38603 
38604 
38605  /// \}
38606 
38607  /// \name Setters
38608  /// \{
38609 
38610 
38611  /**
38612  * \brief Set token for the current ast node
38613  */
38614  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
38615 
38616 
38617 
38618 
38619  /**
38620  * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve (rvalue reference)
38621  */
38622  void set_node_to_solve(std::shared_ptr<Block>&& node_to_solve);
38623 
38624  /**
38625  * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve
38626  */
38627  void set_node_to_solve(const std::shared_ptr<Block>& node_to_solve);
38628 
38629 
38630  /// \}
38631 
38632  /// \name Visitor
38633  /// \{
38634 
38635  /**
38636  * \brief visit children i.e. member variables of current node using provided visitor
38637  *
38638  * Different nodes in the AST have different members (i.e. children). This method
38639  * recursively visits children using provided visitor.
38640  *
38641  * \param v Concrete visitor that will be used to recursively visit children
38642  *
38643  * \sa Ast::visit_children for example.
38644  */
38645  void visit_children(visitor::Visitor& v) override;
38646 
38647  /**
38648  * \brief visit children i.e. member variables of current node using provided visitor
38649  *
38650  * Different nodes in the AST have different members (i.e. children). This method
38651  * recursively visits children using provided visitor.
38652  *
38653  * \param v Concrete constant visitor that will be used to recursively visit children
38654  *
38655  * \sa Ast::visit_children for example.
38656  */
38657  void visit_children(visitor::ConstVisitor& v) const override;
38658 
38659  /**
38660  * \brief accept (or visit) the current AST node using provided visitor
38661  *
38662  * Instead of visiting children of AST node, like Ast::visit_children,
38663  * accept allows to visit the current node itself using provided concrete
38664  * visitor.
38665  *
38666  * \param v Concrete visitor that will be used to recursively visit node
38667  *
38668  * \sa Ast::accept for example.
38669  */
38670  void accept(visitor::Visitor& v) override;
38671 
38672  /**
38673  * \copydoc accept(visitor::Visitor&)
38674  */
38675  void accept(visitor::ConstVisitor& v) const override;
38676 
38677  /// \}
38678 
38679 
38680 
38681  private:
38682  /**
38683  * \brief Set this object as parent for all the children
38684  *
38685  * This should be called in every object (with children) constructor
38686  * to set parents. Since it is called only in the constructors it
38687  * should not be virtual to avoid ambiguities (issue #295).
38688  */
38689  void set_parent_in_children();
38690 };
38691 
38692 /** @} */ // end of ast_class
38693 
38694 
38695 } // namespace ast
38696 } // namespace nmodl
38697 #endif // !NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
38698 #ifndef NMODL_AST_SOLUTION_EXPRESSION_HPP
38699 #define NMODL_AST_SOLUTION_EXPRESSION_HPP
38700 
38701 
38702 namespace nmodl {
38703 namespace ast {
38704 
38705 /**
38706  * @addtogroup ast_class
38707  * @ingroup ast
38708  * @{
38709  */
38710 
38711 /**
38712  * \brief Represent solution of a block in the AST
38713  *
38714  *
38715 */
38717  private:
38718  ///
38719  std::shared_ptr<SolveBlock> solve_block;
38720  /// Block to be solved (callback node or solution node itself)
38721  std::shared_ptr<Expression> node_to_solve;
38722  /// token with location information
38723  std::shared_ptr<ModToken> token;
38724 
38725  public:
38726 
38727  /// \name Ctor & dtor
38728  /// \{
38729 
38730  explicit SolutionExpression(SolveBlock* solve_block, Expression* node_to_solve);
38731  explicit SolutionExpression(const std::shared_ptr<SolveBlock>& solve_block, const std::shared_ptr<Expression>& node_to_solve);
38733 
38734 
38735  virtual ~SolutionExpression() = default;
38736 
38737  /// \}
38738 
38739 
38740 
38741 
38742 
38743 
38744  /**
38745  * \brief Check if the ast node is an instance of ast::SolutionExpression
38746  * \return true as object is of type ast::SolutionExpression
38747  */
38748  bool is_solution_expression () const noexcept override {
38749  return true;
38750  }
38751 
38752  /**
38753  * \brief Return a copy of the current node
38754  *
38755  * Recursively make a new copy/clone of the current node including
38756  * all members and return a pointer to the node. This is used for
38757  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
38758  * ast.
38759  *
38760  * @return pointer to the clone/copy of the current node
38761  */
38762  SolutionExpression* clone() const override {
38763  return new SolutionExpression(*this);
38764  }
38765 
38766  /// \name Getters
38767  /// \{
38768 
38769  /**
38770  * \brief Return type (ast::AstNodeType) of ast node
38771  *
38772  * Every node in the ast has a type defined in ast::AstNodeType and this
38773  * function is used to retrieve the same.
38774  *
38775  * \return ast node type i.e. ast::AstNodeType::SOLUTION_EXPRESSION
38776  *
38777  * \sa Ast::get_node_type_name
38778  */
38779  AstNodeType get_node_type() const noexcept override {
38781  }
38782 
38783  /**
38784  * \brief Return type (ast::AstNodeType) of ast node as std::string
38785  *
38786  * Every node in the ast has a type defined in ast::AstNodeType.
38787  * This type name can be returned as a std::string for printing
38788  * node to text/json form.
38789  *
38790  * \return name of the node type as a string i.e. "SolutionExpression"
38791  *
38792  * \sa Ast::get_node_name
38793  */
38794  std::string get_node_type_name() const noexcept override {
38795  return "SolutionExpression";
38796  }
38797 
38798 
38799  /**
38800  * \brief Get std::shared_ptr from `this` pointer of the current ast node
38801  */
38802  std::shared_ptr<Ast> get_shared_ptr() override {
38803  return std::static_pointer_cast<SolutionExpression>(shared_from_this());
38804  }
38805 
38806  /**
38807  * \brief Get std::shared_ptr from `this` pointer of the current ast node
38808  */
38809  std::shared_ptr<const Ast> get_shared_ptr() const override {
38810  return std::static_pointer_cast<const SolutionExpression>(shared_from_this());
38811  }
38812 
38813  /**
38814  * \brief Return associated token for the current ast node
38815  *
38816  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
38817  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
38818  * nullptr to store in the nmodl::symtab::SymbolTable.
38819  *
38820  * \return pointer to token if exist otherwise nullptr
38821  */
38822  const ModToken* get_token() const noexcept override {
38823  return token.get();
38824  }
38825 
38826 
38827 
38828 
38829 
38830 
38831 
38832 
38833  /**
38834  * \brief Getter for member variable \ref SolutionExpression.solve_block
38835  */
38836  const std::shared_ptr<SolveBlock>& get_solve_block() const noexcept {
38837  return solve_block;
38838  }
38839 
38840 
38841 
38842 
38843 
38844 
38845 
38846  /**
38847  * \brief Getter for member variable \ref SolutionExpression.node_to_solve
38848  */
38849  const std::shared_ptr<Expression>& get_node_to_solve() const noexcept {
38850  return node_to_solve;
38851  }
38852 
38853 
38854 
38855  /// \}
38856 
38857  /// \name Setters
38858  /// \{
38859 
38860 
38861  /**
38862  * \brief Set token for the current ast node
38863  */
38864  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
38865 
38866 
38867 
38868 
38869  /**
38870  * \brief Setter for member variable \ref SolutionExpression.solve_block (rvalue reference)
38871  */
38872  void set_solve_block(std::shared_ptr<SolveBlock>&& solve_block);
38873 
38874  /**
38875  * \brief Setter for member variable \ref SolutionExpression.solve_block
38876  */
38877  void set_solve_block(const std::shared_ptr<SolveBlock>& solve_block);
38878 
38879 
38880  /**
38881  * \brief Setter for member variable \ref SolutionExpression.node_to_solve (rvalue reference)
38882  */
38883  void set_node_to_solve(std::shared_ptr<Expression>&& node_to_solve);
38884 
38885  /**
38886  * \brief Setter for member variable \ref SolutionExpression.node_to_solve
38887  */
38888  void set_node_to_solve(const std::shared_ptr<Expression>& node_to_solve);
38889 
38890 
38891  /// \}
38892 
38893  /// \name Visitor
38894  /// \{
38895 
38896  /**
38897  * \brief visit children i.e. member variables of current node using provided visitor
38898  *
38899  * Different nodes in the AST have different members (i.e. children). This method
38900  * recursively visits children using provided visitor.
38901  *
38902  * \param v Concrete visitor that will be used to recursively visit children
38903  *
38904  * \sa Ast::visit_children for example.
38905  */
38906  void visit_children(visitor::Visitor& v) override;
38907 
38908  /**
38909  * \brief visit children i.e. member variables of current node using provided visitor
38910  *
38911  * Different nodes in the AST have different members (i.e. children). This method
38912  * recursively visits children using provided visitor.
38913  *
38914  * \param v Concrete constant visitor that will be used to recursively visit children
38915  *
38916  * \sa Ast::visit_children for example.
38917  */
38918  void visit_children(visitor::ConstVisitor& v) const override;
38919 
38920  /**
38921  * \brief accept (or visit) the current AST node using provided visitor
38922  *
38923  * Instead of visiting children of AST node, like Ast::visit_children,
38924  * accept allows to visit the current node itself using provided concrete
38925  * visitor.
38926  *
38927  * \param v Concrete visitor that will be used to recursively visit node
38928  *
38929  * \sa Ast::accept for example.
38930  */
38931  void accept(visitor::Visitor& v) override;
38932 
38933  /**
38934  * \copydoc accept(visitor::Visitor&)
38935  */
38936  void accept(visitor::ConstVisitor& v) const override;
38937 
38938  /// \}
38939 
38940 
38941 
38942  private:
38943  /**
38944  * \brief Set this object as parent for all the children
38945  *
38946  * This should be called in every object (with children) constructor
38947  * to set parents. Since it is called only in the constructors it
38948  * should not be virtual to avoid ambiguities (issue #295).
38949  */
38950  void set_parent_in_children();
38951 };
38952 
38953 /** @} */ // end of ast_class
38954 
38955 
38956 } // namespace ast
38957 } // namespace nmodl
38958 #endif // !NMODL_AST_SOLUTION_EXPRESSION_HPP
38959 #ifndef NMODL_AST_UPDATE_DT_HPP
38960 #define NMODL_AST_UPDATE_DT_HPP
38961 
38962 
38963 namespace nmodl {
38964 namespace ast {
38965 
38966 /**
38967  * @addtogroup ast_class
38968  * @ingroup ast
38969  * @{
38970  */
38971 
38972 /**
38973  * \brief Statement to indicate a change in timestep in a given block
38974  *
38975  *
38976 */
38977 class UpdateDt : public Statement {
38978  private:
38979  /// Value of new timestep
38980  std::shared_ptr<Double> value;
38981  /// token with location information
38982  std::shared_ptr<ModToken> token;
38983 
38984  public:
38985 
38986  /// \name Ctor & dtor
38987  /// \{
38988 
38989  explicit UpdateDt(Double* value);
38990  explicit UpdateDt(const std::shared_ptr<Double>& value);
38991  UpdateDt(const UpdateDt& obj);
38992 
38993 
38994  virtual ~UpdateDt() = default;
38995 
38996  /// \}
38997 
38998 
38999 
39000 
39001 
39002 
39003  /**
39004  * \brief Check if the ast node is an instance of ast::UpdateDt
39005  * \return true as object is of type ast::UpdateDt
39006  */
39007  bool is_update_dt () const noexcept override {
39008  return true;
39009  }
39010 
39011  /**
39012  * \brief Return a copy of the current node
39013  *
39014  * Recursively make a new copy/clone of the current node including
39015  * all members and return a pointer to the node. This is used for
39016  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
39017  * ast.
39018  *
39019  * @return pointer to the clone/copy of the current node
39020  */
39021  UpdateDt* clone() const override {
39022  return new UpdateDt(*this);
39023  }
39024 
39025  /// \name Getters
39026  /// \{
39027 
39028  /**
39029  * \brief Return type (ast::AstNodeType) of ast node
39030  *
39031  * Every node in the ast has a type defined in ast::AstNodeType and this
39032  * function is used to retrieve the same.
39033  *
39034  * \return ast node type i.e. ast::AstNodeType::UPDATE_DT
39035  *
39036  * \sa Ast::get_node_type_name
39037  */
39038  AstNodeType get_node_type() const noexcept override {
39039  return AstNodeType::UPDATE_DT;
39040  }
39041 
39042  /**
39043  * \brief Return type (ast::AstNodeType) of ast node as std::string
39044  *
39045  * Every node in the ast has a type defined in ast::AstNodeType.
39046  * This type name can be returned as a std::string for printing
39047  * node to text/json form.
39048  *
39049  * \return name of the node type as a string i.e. "UpdateDt"
39050  *
39051  * \sa Ast::get_node_name
39052  */
39053  std::string get_node_type_name() const noexcept override {
39054  return "UpdateDt";
39055  }
39056 
39057  /**
39058  * \brief Return NMODL statement of ast node as std::string
39059  *
39060  * Every node is related to a special statement in the NMODL. This
39061  * statement can be returned as a std::string for printing to
39062  * text/json form.
39063  *
39064  * \return name of the statement as a string i.e. "dt"
39065  *
39066  * \sa Ast::get_nmodl_name
39067  */
39068  std::string get_nmodl_name() const noexcept override {
39069  return "dt";
39070  }
39071 
39072  /**
39073  * \brief Get std::shared_ptr from `this` pointer of the current ast node
39074  */
39075  std::shared_ptr<Ast> get_shared_ptr() override {
39076  return std::static_pointer_cast<UpdateDt>(shared_from_this());
39077  }
39078 
39079  /**
39080  * \brief Get std::shared_ptr from `this` pointer of the current ast node
39081  */
39082  std::shared_ptr<const Ast> get_shared_ptr() const override {
39083  return std::static_pointer_cast<const UpdateDt>(shared_from_this());
39084  }
39085 
39086  /**
39087  * \brief Return associated token for the current ast node
39088  *
39089  * Not all ast nodes have token information. For example, nmodl::visitor::NeuronSolveVisitor
39090  * can insert new nodes in the ast as a solution of ODEs. In this case, we return
39091  * nullptr to store in the nmodl::symtab::SymbolTable.
39092  *
39093  * \return pointer to token if exist otherwise nullptr
39094  */
39095  const ModToken* get_token() const noexcept override {
39096  return token.get();
39097  }
39098 
39099 
39100 
39101 
39102 
39103 
39104 
39105 
39106  /**
39107  * \brief Getter for member variable \ref UpdateDt.value
39108  */
39109  const std::shared_ptr<Double>& get_value() const noexcept {
39110  return value;
39111  }
39112 
39113 
39114 
39115  /// \}
39116 
39117  /// \name Setters
39118  /// \{
39119 
39120 
39121  /**
39122  * \brief Set token for the current ast node
39123  */
39124  void set_token(const ModToken& tok) { token = std::make_shared<ModToken>(tok); }
39125 
39126 
39127 
39128 
39129  /**
39130  * \brief Setter for member variable \ref UpdateDt.value (rvalue reference)
39131  */
39132  void set_value(std::shared_ptr<Double>&& value);
39133 
39134  /**
39135  * \brief Setter for member variable \ref UpdateDt.value
39136  */
39137  void set_value(const std::shared_ptr<Double>& value);
39138 
39139 
39140  /// \}
39141 
39142  /// \name Visitor
39143  /// \{
39144 
39145  /**
39146  * \brief visit children i.e. member variables of current node using provided visitor
39147  *
39148  * Different nodes in the AST have different members (i.e. children). This method
39149  * recursively visits children using provided visitor.
39150  *
39151  * \param v Concrete visitor that will be used to recursively visit children
39152  *
39153  * \sa Ast::visit_children for example.
39154  */
39155  void visit_children(visitor::Visitor& v) override;
39156 
39157  /**
39158  * \brief visit children i.e. member variables of current node using provided visitor
39159  *
39160  * Different nodes in the AST have different members (i.e. children). This method
39161  * recursively visits children using provided visitor.
39162  *
39163  * \param v Concrete constant visitor that will be used to recursively visit children
39164  *
39165  * \sa Ast::visit_children for example.
39166  */
39167  void visit_children(visitor::ConstVisitor& v) const override;
39168 
39169  /**
39170  * \brief accept (or visit) the current AST node using provided visitor
39171  *
39172  * Instead of visiting children of AST node, like Ast::visit_children,
39173  * accept allows to visit the current node itself using provided concrete
39174  * visitor.
39175  *
39176  * \param v Concrete visitor that will be used to recursively visit node
39177  *
39178  * \sa Ast::accept for example.
39179  */
39180  void accept(visitor::Visitor& v) override;
39181 
39182  /**
39183  * \copydoc accept(visitor::Visitor&)
39184  */
39185  void accept(visitor::ConstVisitor& v) const override;
39186 
39187  /// \}
39188 
39189 
39190 
39191  private:
39192  /**
39193  * \brief Set this object as parent for all the children
39194  *
39195  * This should be called in every object (with children) constructor
39196  * to set parents. Since it is called only in the constructors it
39197  * should not be virtual to avoid ambiguities (issue #295).
39198  */
39199  void set_parent_in_children();
39200 };
39201 
39202 /** @} */ // end of ast_class
39203 
39204 
39205 } // namespace ast
39206 } // namespace nmodl
39207 #endif // !NMODL_AST_UPDATE_DT_HPP
39208 
39209 namespace nmodl {
39210 namespace ast {
39211 #ifdef NMODL_AST_ASSIGNED_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
39212 
39213 /**
39214  * \brief Insert members to definitions
39215  */
39216 template <class NodeType, class InputIterator>
39217 void AssignedBlock::insert_assigned_definition(AssignedDefinitionVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last) {
39218 
39219  for (auto it = first; it != last; ++it) {
39220  auto& n = *it;
39221  //set parents
39222  n->set_parent(this);
39223  }
39224  definitions.insert(position, first, last);
39225 }
39226 
39227 #endif // !NMODL_AST_ASSIGNED_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
39228 
39229 #ifdef NMODL_AST_STATEMENT_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
39230 
39231 /**
39232  * \brief Insert members to statements
39233  */
39234 template <class NodeType, class InputIterator>
39235 void StatementBlock::insert_statement(StatementVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last) {
39236 
39237  for (auto it = first; it != last; ++it) {
39238  auto& n = *it;
39239  //set parents
39240  n->set_parent(this);
39241  }
39242  statements.insert(position, first, last);
39243 }
39244 
39245 #endif // !NMODL_AST_STATEMENT_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
39246 
39247 #ifdef NMODL_AST_LOCAL_LIST_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
39248 
39249 /**
39250  * \brief Insert members to variables
39251  */
39252 template <class NodeType, class InputIterator>
39253 void LocalListStatement::insert_local_var(LocalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last) {
39254 
39255  for (auto it = first; it != last; ++it) {
39256  auto& n = *it;
39257  //set parents
39258  n->set_parent(this);
39259  }
39260  variables.insert(position, first, last);
39261 }
39262 
39263 #endif // !NMODL_AST_LOCAL_LIST_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
39264 
39265 #ifdef NMODL_AST_WATCH_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
39266 
39267 /**
39268  * \brief Insert members to statements
39269  */
39270 template <class NodeType, class InputIterator>
39271 void WatchStatement::insert_watch(WatchVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last) {
39272 
39273  for (auto it = first; it != last; ++it) {
39274  auto& n = *it;
39275  //set parents
39276  n->set_parent(this);
39277  }
39278  statements.insert(position, first, last);
39279 }
39280 
39281 #endif // !NMODL_AST_WATCH_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
39282 
39283 #ifdef NMODL_AST_GLOBAL_HPP_INLINE_DEFINITION_REQUIRED
39284 
39285 /**
39286  * \brief Insert members to variables
39287  */
39288 template <class NodeType, class InputIterator>
39289 void Global::insert_global_var(GlobalVarVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last) {
39290 
39291  for (auto it = first; it != last; ++it) {
39292  auto& n = *it;
39293  //set parents
39294  n->set_parent(this);
39295  }
39296  variables.insert(position, first, last);
39297 }
39298 
39299 #endif // !NMODL_AST_GLOBAL_HPP_INLINE_DEFINITION_REQUIRED
39300 
39301 #ifdef NMODL_AST_PROGRAM_HPP_INLINE_DEFINITION_REQUIRED
39302 
39303 /**
39304  * \brief Insert members to blocks
39305  */
39306 template <class NodeType, class InputIterator>
39307 void Program::insert_node(NodeVector::const_iterator position, NodeType& to, InputIterator first, InputIterator last) {
39308 
39309  for (auto it = first; it != last; ++it) {
39310  auto& n = *it;
39311  //set parents
39312  n->set_parent(this);
39313  }
39314  blocks.insert(position, first, last);
39315 }
39316 
39317 #endif // !NMODL_AST_PROGRAM_HPP_INLINE_DEFINITION_REQUIRED
39318 
39319 } // namespace ast
39320 } // namespace nmodl
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29028
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:20186
type of ast::DiscreteBlock
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15994
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14596
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18148
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:16024
std::vector< std::shared_ptr< ExternVar > > ExternVarVector
Definition: ast_decl.hpp:361
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27216
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18344
std::shared_ptr< StatementBlock > ifsolerr
Block to be executed on error.
Definition: all.hpp:12942
static const std::string ReactionOpNames[]
string representation of ast::ReactionOp
Definition: ast_common.hpp:107
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12272
std::shared_ptr< Name > steadystate
Name of the integration method.
Definition: all.hpp:12940
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25231
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2791
std::shared_ptr< Expression > length
legth of an array or index position
Definition: all.hpp:3073
const std::shared_ptr< Integer > & get_with() const noexcept
Getter for member variable TableStatement::with.
Definition: all.hpp:32736
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5991
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20446
ThreadsafeVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:6716
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:454
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6763
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7319
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:28091
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14830
type of ast::ConductanceHint
bool is_lag_statement() const noexcept override
Check if the ast node is an instance of ast::LagStatement.
Definition: all.hpp:31803
bool is_constant_statement() const noexcept override
Check if the ast node is an instance of ast::ConstantStatement.
Definition: all.hpp:32339
const NameVector & get_solvefor() const noexcept
Getter for member variable LinearBlock::solvefor.
Definition: all.hpp:10402
GlobalVarVector::const_iterator insert_global_var(GlobalVarVector::const_iterator position, const std::shared_ptr< GlobalVar > &n)
Insert member to variables.
Definition: ast.cpp:14451
LocalListStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:23332
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7010
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14214
Represents SECTION variables statement in NMODL.
Definition: all.hpp:34031
type of ast::WrappedExpression
type of ast::NrnStateBlock
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6570
const std::shared_ptr< Expression > & get_value() const noexcept
Getter for member variable Watch::value.
Definition: all.hpp:21289
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12019
std::shared_ptr< Name > name
Name of the discrete block.
Definition: all.hpp:10922
static const std::string BATypeNames[]
string representation of ast::BAType
Definition: ast_common.hpp:95
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21520
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:36562
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10659
const std::shared_ptr< StatementBlock > & get_setup_x_block() const noexcept
Getter for member variable EigenLinearSolverBlock::setup_x_block.
Definition: all.hpp:38036
bool is_unary_operator() const noexcept override
Check if the ast node is an instance of ast::UnaryOperator.
Definition: all.hpp:18610
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18430
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28179
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32613
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28788
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:25023
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:38723
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3718
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10363
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:37132
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6021
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5280
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable Match::name.
Definition: all.hpp:21777
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5787
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7339
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:39068
const std::shared_ptr< Name > & get_name2() const noexcept
Getter for member variable PartialBoundary::name2.
Definition: all.hpp:29147
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32904
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24493
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35177
bool is_non_linear_block() const noexcept override
Check if the ast node is an instance of ast::NonLinearBlock.
Definition: all.hpp:10613
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5033
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:38982
bool is_reaction_operator() const noexcept override
Check if the ast node is an instance of ast::ReactionOperator.
Definition: all.hpp:18851
const SteppedVector & get_statements() const noexcept
Getter for member variable StepBlock::statements.
Definition: all.hpp:7368
AssignedDefinitionVector::const_iterator insert_assigned_definition(AssignedDefinitionVector::const_iterator position, const std::shared_ptr< AssignedDefinition > &n)
Insert member to definitions.
Definition: ast.cpp:2832
const std::shared_ptr< StatementBlock > & get_finalize_block() const noexcept
Getter for member variable EigenLinearSolverBlock::finalize_block.
Definition: all.hpp:38062
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27584
Double * clone() const override
Return a copy of the current node.
Definition: all.hpp:2019
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable LineComment::statement.
Definition: all.hpp:36191
virtual Block * clone() const override
Return a copy of the current node.
Definition: all.hpp:621
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:97
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22448
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11648
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:33057
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23690
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23108
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:38572
type of ast::FunctionCall
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable DiscreteBlock::name.
Definition: all.hpp:11082
type of ast::EigenLinearSolverBlock
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:183
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30144
UnaryOp
enum type for unary operators
Definition: ast_common.hpp:74
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:35155
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7282
virtual void accept(visitor::Visitor &v) override
accept (or visit) the current AST node using provided visitor
Definition: ast.cpp:367
std::shared_ptr< SolveBlock > solve_block
Definition: all.hpp:38719
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2578
Limits * clone() const override
Return a copy of the current node.
Definition: all.hpp:17303
ExpressionStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26404
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:20461
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15231
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13938
std::shared_ptr< Name > name
Name of the non-linear block.
Definition: all.hpp:10580
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17015
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15466
bool is_param_assign() const noexcept override
Check if the ast node is an instance of ast::ParamAssign.
Definition: all.hpp:24432
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1770
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5935
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25909
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30359
Compartment * clone() const override
Return a copy of the current node.
Definition: all.hpp:30855
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19146
std::shared_ptr< Name > name
Name of the linear block.
Definition: all.hpp:10227
const NonspecificCurVarVector & get_currents() const noexcept
Getter for member variable Nonspecific::currents.
Definition: all.hpp:33666
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:37658
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23590
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5018
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23364
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20431
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1475
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24283
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:11558
Represent token returned by scanner.
Definition: modtoken.hpp:50
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26686
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:36455
Range * clone() const override
Return a copy of the current node.
Definition: all.hpp:34322
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19895
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28720
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22012
bool is_neuron_block() const noexcept override
Check if the ast node is an instance of ast::NeuronBlock.
Definition: all.hpp:16256
const std::shared_ptr< StatementBlock > & get_finalize_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::finalize_block.
Definition: all.hpp:37643
Represents a LAG statement in the mod file.
Definition: all.hpp:31771
Base class for all Abstract Syntax Tree node types.
Definition: ast.hpp:70
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12345
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:35666
std::shared_ptr< Integer > with
an increment factor
Definition: all.hpp:32555
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:35418
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24407
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:33788
bool is_watch() const noexcept override
Check if the ast node is an instance of ast::Watch.
Definition: all.hpp:21188
const std::shared_ptr< Unit > & get_unit2() const noexcept
Getter for member variable FactorDef::unit2.
Definition: all.hpp:22626
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:34121
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18215
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ParamAssign::unit.
Definition: all.hpp:24558
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6183
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3355
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable IfStatement::statement_block.
Definition: all.hpp:27910
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:38565
Represents LINEAR block in the NMODL.
Definition: all.hpp:10224
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4014
DerivimplicitCallback * clone() const override
Return a copy of the current node.
Definition: all.hpp:38525
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7566
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9677
Represents SUFFIX statement in NMODL.
Definition: all.hpp:32897
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:34369
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19123
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7107
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31478
PartialEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:28660
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15530
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10926
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18415
static const std::string BinaryOpNames[]
string representation of ast::BinaryOp
Definition: ast_common.hpp:70
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26700
std::vector< std::shared_ptr< ThreadsafeVar > > ThreadsafeVarVector
Definition: ast_decl.hpp:362
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29975
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32975
DerivativeBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9942
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20650
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:37290
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14786
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31864
bool is_ba_block() const noexcept override
Check if the ast node is an instance of ast::BABlock.
Definition: all.hpp:14465
std::vector< std::shared_ptr< PointerVar > > PointerVarVector
Definition: ast_decl.hpp:359
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable ForNetcon::parameters.
Definition: all.hpp:14872
type of ast::ForAllStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:36206
const std::shared_ptr< Expression > & get_length() const noexcept
Getter for member variable IndexedName::length.
Definition: all.hpp:3213
bool is_line_comment() const noexcept override
Check if the ast node is an instance of ast::LineComment.
Definition: all.hpp:36103
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15372
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3741
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FactorDef::name.
Definition: all.hpp:22574
std::shared_ptr< Expression > increment
TODO.
Definition: all.hpp:26853
Represents TABLE statement in NMODL.
Definition: all.hpp:32544
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11357
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable ElseIfStatement::condition.
Definition: all.hpp:28220
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25487
const ParamAssignVector & get_statements() const noexcept
Getter for member variable ParamBlock::statements.
Definition: all.hpp:7081
std::shared_ptr< String > statement
comment text
Definition: all.hpp:36311
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:27214
bool is_partial_equation() const noexcept override
Check if the ast node is an instance of ast::PartialEquation.
Definition: all.hpp:28646
Represent a callback to NEURON&#39;s derivimplicit solver.
Definition: all.hpp:38481
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4700
Represent queue statement in NMODL.
Definition: all.hpp:32046
bool is_for_netcon() const noexcept override
Check if the ast node is an instance of ast::ForNetcon.
Definition: all.hpp:14755
std::shared_ptr< Expression > lhs
TODO.
Definition: all.hpp:20096
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:36426
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7383
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18472
bool is_react_var_name() const noexcept override
Check if the ast node is an instance of ast::ReactVarName.
Definition: all.hpp:3960
const std::shared_ptr< Name > & get_type() const noexcept
Getter for member variable Suffix::type.
Definition: all.hpp:33017
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable FunctionTableBlock::parameters.
Definition: all.hpp:11729
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24199
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24463
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1460
NonLinEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:20139
type of ast::ConstantVar
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1022
NodeVector blocks
Vector of top level blocks in the mod file.
Definition: all.hpp:36810
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:35829
const std::shared_ptr< Number > & get_from() const noexcept
Getter for member variable AssignedDefinition::from.
Definition: all.hpp:25567
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19602
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32370
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21507
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17842
type of ast::PointerVar
std::shared_ptr< Integer > value
Value of the macro.
Definition: all.hpp:23839
std::shared_ptr< String > value
Value of name.
Definition: all.hpp:2519
type of ast::PartialBlock
Float * clone() const override
Return a copy of the current node.
Definition: all.hpp:1738
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10321
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:28928
type of ast::BreakpointBlock
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6075
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:840
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27841
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11675
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19319
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:31113
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:19837
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30173
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33276
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:11240
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28248
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4786
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:37509
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:38486
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33880
const ElseIfStatementVector & get_elseifs() const noexcept
Getter for member variable IfStatement::elseifs.
Definition: all.hpp:27923
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:34618
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28508
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5759
std::shared_ptr< StatementBlock > initialize_block
Statement block to be executed before calling newton solver.
Definition: all.hpp:37411
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26857
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8698
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11372
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11768
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2871
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31933
Represents a variable.
Definition: all.hpp:3346
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20200
bool is_match_block() const noexcept override
Check if the ast node is an instance of ast::MatchBlock.
Definition: all.hpp:15398
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16331
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:37013
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7603
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13404
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6239
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13039
const std::shared_ptr< Name > & get_type() const noexcept
Getter for member variable Valence::type.
Definition: all.hpp:22907
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3434
type of ast::ExpressionStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19730
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11662
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2328
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2863
const std::shared_ptr< StatementBlock > & get_functor_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::functor_block.
Definition: all.hpp:37617
const std::shared_ptr< StatementBlock > & get_ifsolerr() const noexcept
Getter for member variable SolveBlock::ifsolerr.
Definition: all.hpp:13127
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4779
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12006
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:38822
UnaryOp value
TODO.
Definition: all.hpp:18583
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32751
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6430
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:38077
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17363
bool is_queue_expression_type() const noexcept override
Check if the ast node is an instance of ast::QueueExpressionType.
Definition: all.hpp:21446
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14251
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9386
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:38088
WatchStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:29398
bool is_lin_equation() const noexcept override
Check if the ast node is an instance of ast::LinEquation.
Definition: all.hpp:20400
type of ast::IndependentBlock
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26185
External * clone() const override
Return a copy of the current node.
Definition: all.hpp:35371
NumberVector values
TODO.
Definition: all.hpp:24726
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29035
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28459
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27770
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26713
type of ast::LocalListStatement
type of ast::ReactionStatement
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DerivativeBlock::statement_block.
Definition: all.hpp:10070
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:37301
type of ast::ElseIfStatement
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8991
std::shared_ptr< Expression > left_linxpression
TODO.
Definition: all.hpp:20371
void negate() override
Negate the value of current ast node.
Definition: all.hpp:2182
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3154
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13923
ConstructorBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9032
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ConstructorBlock::statement_block.
Definition: all.hpp:9135
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable PlotVar::name.
Definition: all.hpp:17899
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:120
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:38864
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31522
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:15164
Represents specific element of an array variable.
Definition: all.hpp:3068
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9664
std::shared_ptr< String > value
Name of prime variable.
Definition: all.hpp:2787
QueueStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:32092
std::shared_ptr< Integer > value
TODO.
Definition: all.hpp:3931
NonspecificCurVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4739
std::shared_ptr< Integer > n_state_vars
number of state vars used in solve
Definition: all.hpp:37407
bool is_before_block() const noexcept override
Check if the ast node is an instance of ast::BeforeBlock.
Definition: all.hpp:13892
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29459
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17872
bool is_partial_block() const noexcept override
Check if the ast node is an instance of ast::PartialBlock.
Definition: all.hpp:11269
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15136
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4552
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28479
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:15242
bool is_number() const noexcept override
Check if the ast node is an instance of ast::Number.
Definition: all.hpp:968
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13995
const std::shared_ptr< StatementBlock > & get_variable_block() const noexcept
Getter for member variable EigenLinearSolverBlock::variable_block.
Definition: all.hpp:38010
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14511
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22935
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17101
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NeuronBlock::statement_block.
Definition: all.hpp:16373
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:36313
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22248
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable FunctionBlock::parameters.
Definition: all.hpp:12073
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:999
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7509
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24221
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10984
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24214
bool is_derivimplicit_callback() const noexcept override
Check if the ast node is an instance of ast::DerivimplicitCallback.
Definition: all.hpp:38511
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13717
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:16359
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:9282
bool is_else_if_statement() const noexcept override
Check if the ast node is an instance of ast::ElseIfStatement.
Definition: all.hpp:28118
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17786
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20706
type of ast::DoubleUnit
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27316
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10674
LocalVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:17054
ElectrodeCurVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4986
Represents a BREAKPOINT block in NMODL.
Definition: all.hpp:13304
BAType get_value() const noexcept
Getter for member variable BABlockType::value.
Definition: all.hpp:22039
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19910
std::shared_ptr< QueueExpressionType > qtype
queue type (put/get)
Definition: all.hpp:32049
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:37261
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25124
type of ast::UnaryOperator
bool is_non_lin_equation() const noexcept override
Check if the ast node is an instance of ast::NonLinEquation.
Definition: all.hpp:20125
virtual const ArgumentVector & get_parameters() const
Definition: all.hpp:596
Match * clone() const override
Return a copy of the current node.
Definition: all.hpp:21703
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13660
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30166
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24829
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:27487
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4756
Represents a block to be executed before or after another block.
Definition: all.hpp:14431
std::shared_ptr< ConstantVar > constant
single constant variable
Definition: all.hpp:32312
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3761
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20468
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5581
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12367
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:33239
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:35445
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:16399
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34970
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ConstantVar::name.
Definition: all.hpp:18174
ElectrodeCurVarVector currents
Vector of electrode current variables.
Definition: all.hpp:33786
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24786
std::shared_ptr< Name > name
Variable name.
Definition: all.hpp:6181
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6509
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3991
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:12266
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32990
const std::shared_ptr< PlotDeclaration > & get_plot() const noexcept
Getter for member variable PlotBlock::plot.
Definition: all.hpp:8555
std::string value
Value of string.
Definition: all.hpp:1139
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8788
std::shared_ptr< StatementBlock > update_states_block
update back states from X
Definition: all.hpp:37849
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28998
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:26847
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:37024
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable FunctionBlock::statement_block.
Definition: all.hpp:12099
const ThreadsafeVarVector & get_variables() const noexcept
Getter for member variable ThreadSafe::variables.
Definition: all.hpp:35707
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32413
const std::shared_ptr< Expression > & get_to() const noexcept
Getter for member variable FromStatement::to.
Definition: all.hpp:27022
std::shared_ptr< StatementBlock > setup_x_block
update X from states
Definition: all.hpp:37413
VarName * clone() const override
Return a copy of the current node.
Definition: all.hpp:3394
Represent CONSERVE statement in NMODL.
Definition: all.hpp:30532
const StatementVector & get_solve_statements() const noexcept
Getter for member variable NrnStateBlock::solve_statements.
Definition: all.hpp:37275
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4840
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31285
bool is_double() const noexcept override
Check if the ast node is an instance of ast::Double.
Definition: all.hpp:2005
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17865
std::shared_ptr< Name > name1
TODO.
Definition: all.hpp:28934
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27371
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable WriteIonVar::name.
Definition: all.hpp:4578
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable BbcorePointerVar::name.
Definition: all.hpp:6308
ConductanceHint * clone() const override
Return a copy of the current node.
Definition: all.hpp:26131
std::shared_ptr< Double > value
Value of new timestep.
Definition: all.hpp:38980
BreakpointBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:13350
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26421
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5273
Base class for all expressions in the NMODL.
Definition: all.hpp:401
FirstLastType value
TODO.
Definition: all.hpp:20919
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16302
const std::shared_ptr< Number > & get_value() const noexcept
Getter for member variable ParamAssign::value.
Definition: all.hpp:24545
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11121
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:14244
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DestructorBlock::statement_block.
Definition: all.hpp:9428
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30381
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21477
type of ast::ParamBlock
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23406
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1269
std::shared_ptr< Unit > unit
Unit for the variable.
Definition: all.hpp:18047
bool is_while_statement() const noexcept override
Check if the ast node is an instance of ast::WhileStatement.
Definition: all.hpp:27516
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34921
const SectionVarVector & get_sections() const noexcept
Getter for member variable Section::sections.
Definition: all.hpp:34162
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7032
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29415
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21219
bool is_pointer() const noexcept override
Check if the ast node is an instance of ast::Pointer.
Definition: all.hpp:34853
Represents an INCLUDE statement in NMODL.
Definition: all.hpp:24121
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:12270
Represent MUTEXLOCK statement in NMODL.
Definition: all.hpp:29651
Represents binary expression in the NMODL.
Definition: all.hpp:19310
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11110
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25865
Represents a string.
Definition: all.hpp:1136
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16593
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:303
const std::shared_ptr< String > & get_value() const noexcept
Getter for member variable Name::value.
Definition: all.hpp:2647
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29042
TableStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:32596
bool is_double_unit() const noexcept override
Check if the ast node is an instance of ast::DoubleUnit.
Definition: all.hpp:16781
Wrap any other expression type.
Definition: all.hpp:38246
bool is_extern_var() const noexcept override
Check if the ast node is an instance of ast::ExternVar.
Definition: all.hpp:6455
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20736
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:33595
std::shared_ptr< Name > name
Name of the macro.
Definition: all.hpp:23837
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:17013
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable IndependentDefinition::unit.
Definition: all.hpp:25216
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27491
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21805
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8425
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22054
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21019
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6677
ReactionOp
enum type used for Reaction statement
Definition: ast_common.hpp:104
std::vector< std::shared_ptr< Statement > > StatementVector
Definition: ast_decl.hpp:336
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28193
type of ast::ReactVarName
const std::shared_ptr< Double > & get_min() const noexcept
Getter for member variable Limits::min.
Definition: all.hpp:17377
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16038
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1637
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26970
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34135
FirstLastType
enum type for partial equation types
Definition: ast_common.hpp:80
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26451
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29962
std::string eval() const
Return enum value in string form.
Definition: all.hpp:22122
LinearBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10274
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28942
const std::shared_ptr< Name > & get_steadystate() const noexcept
Getter for member variable SolveBlock::steadystate.
Definition: all.hpp:13114
Represents a C code block.
Definition: all.hpp:35824
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21735
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23676
const std::shared_ptr< String > & get_ontology_id() const noexcept
Getter for member variable Useion::ontology_id.
Definition: all.hpp:33374
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23053
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:661
EigenLinearSolverBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:37894
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3748
std::shared_ptr< Number > from
TODO.
Definition: all.hpp:25015
bool is_global() const noexcept override
Check if the ast node is an instance of ast::Global.
Definition: all.hpp:34557
const std::shared_ptr< String > & get_filename() const noexcept
Getter for member variable Include::filename.
Definition: all.hpp:24255
Operator used in ast::BinaryExpression.
Definition: all.hpp:18339
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26444
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:832
std::shared_ptr< Integer > order
order of ODE
Definition: all.hpp:2789
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:38307
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8802
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5497
Represent solution of a block in the AST.
Definition: all.hpp:38716
std::shared_ptr< Expression > reaction1
TODO.
Definition: all.hpp:31412
std::vector< std::shared_ptr< ParamAssign > > ParamAssignVector
Definition: ast_decl.hpp:424
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34632
const std::shared_ptr< Number > & get_value() const noexcept
Getter for member variable ConstantVar::value.
Definition: all.hpp:18187
Represents POINTER statement in NMODL.
Definition: all.hpp:34824
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19688
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:33610
type of ast::ConstantStatement
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Stepped::name.
Definition: all.hpp:24843
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17094
const std::shared_ptr< Integer > & get_with() const noexcept
Getter for member variable IndependentDefinition::with.
Definition: all.hpp:25190
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34645
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14539
const std::shared_ptr< Expression > & get_expr() const noexcept
Getter for member variable Conserve::expr.
Definition: all.hpp:30679
UnaryOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:18624
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable Valence::value.
Definition: all.hpp:22920
ReactionOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:18865
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13032
ReactionOp get_value() const noexcept
Getter for member variable ReactionOperator::value.
Definition: all.hpp:18939
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12114
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2059
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20991
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36895
const std::shared_ptr< String > & get_name() const noexcept
Getter for member variable Unit::name.
Definition: all.hpp:16632
std::vector< std::shared_ptr< RangeVar > > RangeVarVector
Definition: ast_decl.hpp:357
const std::shared_ptr< Integer > & get_index() const noexcept
Getter for member variable PlotVar::index.
Definition: all.hpp:17912
const std::shared_ptr< String > & get_title() const noexcept
Getter for member variable Model::title.
Definition: all.hpp:23717
bool is_nrn_state_block() const noexcept override
Check if the ast node is an instance of ast::NrnStateBlock.
Definition: all.hpp:37158
type of ast::ConstantBlock
const NameVector & get_depend_vars() const noexcept
Getter for member variable TableStatement::depend_vars.
Definition: all.hpp:32697
ReadIonVarVector readlist
Variables being read.
Definition: all.hpp:33175
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9372
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9989
NameVector solvefor
TODO.
Definition: all.hpp:10229
const std::shared_ptr< Integer > & get_length() const noexcept
Getter for member variable AssignedDefinition::length.
Definition: all.hpp:25554
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7096
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Define::name.
Definition: all.hpp:23980
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36164
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29707
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:653
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36662
bool is_assigned_definition() const noexcept override
Check if the ast node is an instance of ast::AssignedDefinition.
Definition: all.hpp:25441
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12709
type of ast::Verbatim
const std::shared_ptr< VarName > & get_name() const noexcept
Getter for member variable ReactVarName::name.
Definition: all.hpp:4073
Define * clone() const override
Return a copy of the current node.
Definition: all.hpp:23880
std::shared_ptr< Block > node_to_solve
Block to be solved (typically derivative)
Definition: all.hpp:38484
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16507
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4204
Represents GLOBAL statement in NMODL.
Definition: all.hpp:34528
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:33625
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12731
IndexedName * clone() const override
Return a copy of the current node.
Definition: all.hpp:3114
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16324
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:36872
type of ast::ElseStatement
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31515
Represents a AFTER block in NMODL.
Definition: after_block.hpp:57
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable AssignedDefinition::name.
Definition: all.hpp:25541
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23294
Represents a CONSTRUCTOR block in the NMODL.
Definition: all.hpp:8986
const std::shared_ptr< Number > & get_to() const noexcept
Getter for member variable AssignedDefinition::to.
Definition: all.hpp:25580
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29472
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28466
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DiscreteBlock::statement_block.
Definition: all.hpp:11095
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:34829
std::shared_ptr< PlotDeclaration > plot
Vector of plot variables.
Definition: all.hpp:8423
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ProtectStatement::expression.
Definition: all.hpp:26727
Represent a single variable of type BBCOREPOINTER.
Definition: all.hpp:6178
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:14326
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:38557
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:36177
bool is_destructor_block() const noexcept override
Check if the ast node is an instance of ast::DestructorBlock.
Definition: all.hpp:9311
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:30812
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17624
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:38809
bool is_number_range() const noexcept override
Check if the ast node is an instance of ast::NumberRange.
Definition: all.hpp:17550
std::vector< std::shared_ptr< Node > > NodeVector
Definition: ast_decl.hpp:335
const std::shared_ptr< Unit > & get_unit1() const noexcept
Getter for member variable UnitDef::unit1.
Definition: all.hpp:22294
Represents a INITIAL block in the NMODL.
Definition: all.hpp:8695
Include * clone() const override
Return a copy of the current node.
Definition: all.hpp:24167
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:638
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ParenExpression::expression.
Definition: all.hpp:19180
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:15736
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25111
type of ast::LinearBlock
Represents a one line comment in NMODL.
Definition: all.hpp:36073
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32124
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8830
std::shared_ptr< String > statement
C code as a string.
Definition: all.hpp:35827
type of ast::StateBlock
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:16754
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7039
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32132
void negate() override
Negate the value of current ast node.
Definition: all.hpp:2451
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23393
std::shared_ptr< Name > name
Name of the derivative block.
Definition: all.hpp:9897
std::shared_ptr< Expression > react
TODO.
Definition: all.hpp:30535
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28700
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable Argument::unit.
Definition: all.hpp:3800
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17405
const VarNameVector & get_variables() const noexcept
Getter for member variable Sens::variables.
Definition: all.hpp:30415
const std::shared_ptr< StatementBlock > & get_update_states_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::update_states_block.
Definition: all.hpp:37630
const RangeVarVector & get_variables() const noexcept
Getter for member variable Range::variables.
Definition: all.hpp:34410
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13746
bool is_limits() const noexcept override
Check if the ast node is an instance of ast::Limits.
Definition: all.hpp:17289
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3426
const std::shared_ptr< StatementBlock > & get_update_states_block() const noexcept
Getter for member variable EigenLinearSolverBlock::update_states_block.
Definition: all.hpp:38049
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30388
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19166
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31117
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable KineticBlock::name.
Definition: all.hpp:15190
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ElseStatement::statement_block.
Definition: all.hpp:28493
Boolean * clone() const override
Return a copy of the current node.
Definition: all.hpp:2288
symtab::ModelSymbolTable * get_model_symbol_table()
Return global symbol table for the mod file.
Definition: all.hpp:36938
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:25412
bool is_reset() const noexcept override
Check if the ast node is an instance of ast::Reset.
Definition: all.hpp:30098
const std::shared_ptr< Name > & get_name1() const noexcept
Getter for member variable PartialEquation::name1.
Definition: all.hpp:28747
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5688
const std::shared_ptr< Integer > & get_value() const noexcept
Getter for member variable ReactVarName::value.
Definition: all.hpp:4048
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:25013
bool is_block() const noexcept override
Check if the ast node is an instance of ast::Block.
Definition: all.hpp:607
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14728
const std::shared_ptr< Integer > & get_n_state_vars() const noexcept
Getter for member variable EigenLinearSolverBlock::n_state_vars.
Definition: all.hpp:37997
Represent statement in CONSTANT block of NMODL.
Definition: all.hpp:32309
std::shared_ptr< Double > max
TODO.
Definition: all.hpp:17262
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:35197
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34148
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10783
type of ast::NonLinearBlock
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable IfStatement::condition.
Definition: all.hpp:27897
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9342
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6748
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5439
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16842
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10348
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1403
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9780
bool is_partial_boundary() const noexcept override
Check if the ast node is an instance of ast::PartialBoundary.
Definition: all.hpp:28967
Represents top level AST node for whole NMODL input.
Definition: all.hpp:36807
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2079
bool is_queue_statement() const noexcept override
Check if the ast node is an instance of ast::QueueStatement.
Definition: all.hpp:32078
AssignedDefinition * clone() const override
Return a copy of the current node.
Definition: all.hpp:25455
NonLinearBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10627
OntologyStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:36601
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25472
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6006
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:37551
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24478
IfStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:27809
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:9899
FunctionCall * clone() const override
Return a copy of the current node.
Definition: all.hpp:20689
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26928
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:14726
std::shared_ptr< Expression > from
TODO.
Definition: all.hpp:26849
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24008
const std::shared_ptr< Expression > & get_reaction2() const noexcept
Getter for member variable ReactionStatement::reaction2.
Definition: all.hpp:31575
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12387
bool is_name() const noexcept override
Check if the ast node is an instance of ast::Name.
Definition: all.hpp:2547
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11337
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:38802
Represents a STEPPED block in the NMODL.
Definition: all.hpp:7220
const std::shared_ptr< Name > & get_ion() const noexcept
Getter for member variable ConductanceHint::ion.
Definition: all.hpp:26232
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:34914
String * clone() const override
Return a copy of the current node.
Definition: all.hpp:1180
Valence * clone() const override
Return a copy of the current node.
Definition: all.hpp:22833
Pointer * clone() const override
Return a copy of the current node.
Definition: all.hpp:34867
std::shared_ptr< Expression > to
TODO.
Definition: all.hpp:26851
bool is_global_var() const noexcept override
Check if the ast node is an instance of ast::GlobalVar.
Definition: all.hpp:5713
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17264
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:28932
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23180
const std::shared_ptr< Boolean > & get_gt() const noexcept
Getter for member variable FactorDef::gt.
Definition: all.hpp:22613
PlotVarVector variables
TODO.
Definition: all.hpp:25805
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:37669
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30916
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27604
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19375
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29918
ConstantBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:15977
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35432
std::shared_ptr< Number > from
TODO.
Definition: all.hpp:25406
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18897
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:15501
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24801
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5250
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:14816
std::shared_ptr< StatementBlock > functor_block
odes as functor for eigen
Definition: all.hpp:37415
NameVector table_vars
Variables in the table.
Definition: all.hpp:32547
ReadIonVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4245
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:30810
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23646
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17581
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8570
type of ast::Nonspecific
AssignedDefinitionVector definitions
Vector of state variables.
Definition: all.hpp:8138
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable NonspecificCurVar::name.
Definition: all.hpp:4825
LinEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:20414
BinaryExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:19358
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20171
bool is_binary_operator() const noexcept override
Check if the ast node is an instance of ast::BinaryOperator.
Definition: all.hpp:18369
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12360
std::shared_ptr< Integer > at
Value specified with @
Definition: all.hpp:3351
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18443
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ReadIonVar::name.
Definition: all.hpp:4331
LocalVarVector::const_iterator insert_local_var(LocalVarVector::const_iterator position, const std::shared_ptr< LocalVar > &n)
Insert member to variables.
Definition: ast.cpp:8938
std::string value
Value of float.
Definition: all.hpp:1698
const std::shared_ptr< Name > & get_name3() const noexcept
Getter for member variable PartialEquation::name3.
Definition: all.hpp:28773
virtual Identifier * clone() const override
Return a copy of the current node.
Definition: all.hpp:800
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:11898
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9121
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12330
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2593
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9657
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9106
FunctionTableBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11601
type of ast::BeforeBlock
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable LagStatement::name.
Definition: all.hpp:31905
WatchVector statements
Vector of watch statements.
Definition: all.hpp:29358
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7067
Represent CONSTANT block in the mod file.
Definition: all.hpp:15932
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20921
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8498
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2608
std::vector< std::shared_ptr< Number > > NumberVector
Definition: ast_decl.hpp:340
bool is_useion() const noexcept override
Check if the ast node is an instance of ast::Useion.
Definition: all.hpp:33208
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6323
Represents a ASSIGNED block in the NMODL.
Definition: all.hpp:7797
const std::shared_ptr< Name > & get_conductance() const noexcept
Getter for member variable ConductanceHint::conductance.
Definition: all.hpp:26219
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11633
Represents RANGE variables statement in NMODL.
Definition: all.hpp:34279
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27309
const std::shared_ptr< Name > & get_block_name() const noexcept
Getter for member variable SolveBlock::block_name.
Definition: all.hpp:13088
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:14286
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable DoubleUnit::unit.
Definition: all.hpp:16882
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28707
BABlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:14479
type of ast::PartialBoundary
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25902
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36655
bool is_kinetic_block() const noexcept override
Check if the ast node is an instance of ast::KineticBlock.
Definition: all.hpp:15061
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1029
const GlobalVarVector & get_variables() const noexcept
Getter for member variable Global::variables.
Definition: all.hpp:34707
std::shared_ptr< String > statement
comment text
Definition: all.hpp:36076
type of ast::ProtectStatement
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32109
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10688
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:37479
type of ast::External
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1785
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11041
bool is_identifier() const noexcept override
Check if the ast node is an instance of ast::Identifier.
Definition: all.hpp:786
Represents a BEFORE block in NMODL.
Definition: all.hpp:13860
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26178
Represent symbol table for a NMODL block.
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:38542
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13682
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30539
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6938
std::shared_ptr< StatementBlock > variable_block
Statements to be declared in the functor.
Definition: all.hpp:37843
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22169
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21750
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable UnaryExpression::expression.
Definition: all.hpp:19965
encapsulates everything related to NMODL code generation framework
Definition: ast_common.hpp:26
const std::shared_ptr< Integer > & get_n_state_vars() const noexcept
Getter for member variable EigenNewtonSolverBlock::n_state_vars.
Definition: all.hpp:37565
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:33254
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionCall::name.
Definition: all.hpp:20775
type of ast::MatchBlock
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16229
ThreadsafeVarVector variables
Vector of thread safe variables.
Definition: all.hpp:35579
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4947
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27591
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:28089
bool is_initial_block() const noexcept override
Check if the ast node is an instance of ast::InitialBlock.
Definition: all.hpp:8727
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4088
std::shared_ptr< Name > name
Name of the channel.
Definition: all.hpp:32902
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30374
std::shared_ptr< PrimeName > prime
TODO.
Definition: all.hpp:28613
const UnaryOperator & get_op() const noexcept
Getter for member variable UnaryExpression::op.
Definition: all.hpp:19952
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32194
std::vector< std::shared_ptr< ElseIfStatement > > ElseIfStatementVector
Definition: ast_decl.hpp:436
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable NonLinearBlock::name.
Definition: all.hpp:10742
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4451
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:26598
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23661
ElseStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:28405
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4945
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:33681
bool is_independent_definition() const noexcept override
Check if the ast node is an instance of ast::IndependentDefinition.
Definition: all.hpp:25050
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14315
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2335
IndependentBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7549
const IndependentDefinitionVector & get_definitions() const noexcept
Getter for member variable IndependentBlock::definitions.
Definition: all.hpp:7652
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:36369
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:469
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28164
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35425
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5265
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12125
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:14911
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1197
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ForNetcon::statement_block.
Definition: all.hpp:14885
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:38337
std::shared_ptr< Boolean > sweep
TODO.
Definition: all.hpp:25011
std::shared_ptr< Name > name
Name of the procedure.
Definition: all.hpp:12264
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:35474
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32393
std::vector< std::shared_ptr< Name > > NameVector
Definition: ast_decl.hpp:346
IndependentDefinition * clone() const override
Return a copy of the current node.
Definition: all.hpp:25064
std::shared_ptr< Name > block_name
Name of the block to solve.
Definition: all.hpp:12936
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29549
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:38614
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4277
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31508
Watch * clone() const override
Return a copy of the current node.
Definition: all.hpp:21202
BinaryOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:18383
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:2458
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27870
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8581
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19701
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:37968
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19673
Represents DERIVATIVE block in the NMODL.
Definition: all.hpp:9894
std::shared_ptr< StatementBlock > update_states_block
update back states from X
Definition: all.hpp:37417
UnitStateType value
TODO.
Definition: all.hpp:23051
ProtectStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26639
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26943
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1240
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:33269
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13967
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22548
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25025
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:12634
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4509
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12751
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:34091
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:273
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:26363
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4034
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5540
FactorDef * clone() const override
Return a copy of the current node.
Definition: all.hpp:22488
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36413
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32053
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4262
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3411
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26950
std::shared_ptr< Unit > unit1
TODO.
Definition: all.hpp:22165
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30639
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25809
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:35581
bool is_threadsafe_var() const noexcept override
Check if the ast node is an instance of ast::ThreadsafeVar.
Definition: all.hpp:6702
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:36399
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35673
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:37516
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:296
std::shared_ptr< Expression > expr
TODO.
Definition: all.hpp:30537
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:36633
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:32643
type of ast::NeuronBlock
const ExpressionVector & get_arguments() const noexcept
Getter for member variable FunctionCall::arguments.
Definition: all.hpp:20788
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:35140
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3161
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17343
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22535
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:36812
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26436
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10441
std::shared_ptr< Identifier > name
Name of array variable.
Definition: all.hpp:3071
WhileStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:27530
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:35388
Represents an argument to functions and procedures.
Definition: all.hpp:3655
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33283
type of ast::InitialBlock
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9064
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8541
Useion * clone() const override
Return a copy of the current node.
Definition: all.hpp:33222
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29360
ReactionOperator op
TODO.
Definition: all.hpp:31414
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10016
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10681
std::vector< std::shared_ptr< Argument > > ArgumentVector
Definition: ast_decl.hpp:350
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8773
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12808
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:34588
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ForAllStatement::name.
Definition: all.hpp:27343
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18713
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18128
std::vector< std::shared_ptr< LocalVar > > LocalVarVector
Definition: ast_decl.hpp:396
ArgumentVector parameters
Arguments to the for netcon block.
Definition: all.hpp:14724
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18912
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:15818
bool is_stepped() const noexcept override
Check if the ast node is an instance of ast::Stepped.
Definition: all.hpp:24755
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15034
std::vector< std::shared_ptr< GlobalVar > > GlobalVarVector
Definition: ast_decl.hpp:358
const NumberVector & get_values() const noexcept
Getter for member variable Stepped::values.
Definition: all.hpp:24856
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5003
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8140
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11300
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable LonDifuse::name.
Definition: all.hpp:31244
bool is_electrode_cur_var() const noexcept override
Check if the ast node is an instance of ast::ElectrodeCurVar.
Definition: all.hpp:4972
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31422
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19390
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8700
std::string value
Value of double.
Definition: all.hpp:1978
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18882
ExternVarVector variables
Vector of external variables.
Definition: all.hpp:35331
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31203
type of ast::FromStatement
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:36384
bool is_linear_block() const noexcept override
Check if the ast node is an instance of ast::LinearBlock.
Definition: all.hpp:10260
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable InitialBlock::statement_block.
Definition: all.hpp:8844
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26957
std::shared_ptr< Identifier > name
Name of the argument.
Definition: all.hpp:3658
QueueType
enum type for queue types
Definition: ast_common.hpp:86
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25096
type of ast::NonspecificCurVar
const std::shared_ptr< Expression > & get_react() const noexcept
Getter for member variable Conserve::react.
Definition: all.hpp:30666
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:19065
type of ast::FunctionBlock
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5767
bool is_procedure_block() const noexcept override
Check if the ast node is an instance of ast::ProcedureBlock.
Definition: all.hpp:12299
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12819
const std::string & get_value() const noexcept
Getter for member variable String::value.
Definition: all.hpp:1254
const WatchVector & get_statements() const noexcept
Getter for member variable WatchStatement::statements.
Definition: all.hpp:29534
std::shared_ptr< Number > start
TODO.
Definition: all.hpp:25021
MatchBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:15412
const std::shared_ptr< Unit > & get_unit2() const noexcept
Getter for member variable UnitDef::unit2.
Definition: all.hpp:22307
WriteIonVarVector writelist
Variables being written.
Definition: all.hpp:33177
const std::shared_ptr< FirstLastTypeIndex > & get_index() const noexcept
Getter for member variable PartialBoundary::index.
Definition: all.hpp:29095
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23732
std::vector< std::shared_ptr< Match > > MatchVector
Definition: ast_decl.hpp:414
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ProcedureBlock::statement_block.
Definition: all.hpp:12467
PlotVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:17825
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11992
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24128
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4285
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16756
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14229
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4021
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28366
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2848
FirstLastType get_value() const noexcept
Getter for member variable FirstLastTypeIndex::value.
Definition: all.hpp:21033
std::shared_ptr< Unit > unit2
TODO.
Definition: all.hpp:22167
NodeVector::const_iterator insert_node(NodeVector::const_iterator position, const std::shared_ptr< Node > &n)
Insert member to blocks.
Definition: ast.cpp:15302
LineComment * clone() const override
Return a copy of the current node.
Definition: all.hpp:36117
VarNameVector variables
TODO.
Definition: all.hpp:30287
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2891
bool is_electrode_current() const noexcept override
Check if the ast node is an instance of ast::ElectrodeCurrent.
Definition: all.hpp:33812
Represents a float variable.
Definition: all.hpp:1695
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:33900
ParamAssignVector statements
Vector of parameters.
Definition: all.hpp:6936
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34425
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20475
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29948
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:6675
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25502
bool is_nonspecific_cur_var() const noexcept override
Check if the ast node is an instance of ast::NonspecificCurVar.
Definition: all.hpp:4725
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2601
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29737
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:34533
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17320
Verbatim * clone() const override
Return a copy of the current node.
Definition: all.hpp:35868
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:16066
type of ast::Conserve
const std::shared_ptr< Number > & get_from() const noexcept
Getter for member variable IndependentDefinition::from.
Definition: all.hpp:25164
FirstLastTypeIndex * clone() const override
Return a copy of the current node.
Definition: all.hpp:20959
const std::shared_ptr< Name > & get_name2() const noexcept
Getter for member variable PartialEquation::name2.
Definition: all.hpp:28760
bool is_section() const noexcept override
Check if the ast node is an instance of ast::Section.
Definition: all.hpp:34060
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:34884
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:37523
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15807
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5933
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1220
Represent linear solver solution block based on Eigen.
Definition: all.hpp:37838
bool is_verbatim() const noexcept override
Check if the ast node is an instance of ast::Verbatim.
Definition: all.hpp:35854
RangeVarVector variables
Vector of range variables.
Definition: all.hpp:34282
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32400
LocalVarVector variables
TODO.
Definition: all.hpp:23292
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5520
std::shared_ptr< Number > min
TODO.
Definition: all.hpp:17521
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15937
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19658
std::vector< std::shared_ptr< VarName > > VarNameVector
Definition: ast_decl.hpp:349
std::shared_ptr< PlotVar > name
TODO.
Definition: all.hpp:25807
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32557
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21304
const LocalVarVector & get_variables() const noexcept
Getter for member variable LocalListStatement::variables.
Definition: all.hpp:23468
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29780
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionTableBlock::name.
Definition: all.hpp:11716
std::shared_ptr< Identifier > name
Name of variable.
Definition: all.hpp:3349
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24586
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16287
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11028
const std::shared_ptr< Unit > & get_unit1() const noexcept
Getter for member variable FactorDef::unit1.
Definition: all.hpp:22600
bool is_constructor_block() const noexcept override
Check if the ast node is an instance of ast::ConstructorBlock.
Definition: all.hpp:9018
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26148
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23941
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20976
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31210
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21048
Global * clone() const override
Return a copy of the current node.
Definition: all.hpp:34571
std::shared_ptr< Expression > lhs
LHS of the binary expression.
Definition: all.hpp:19313
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26464
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23703
const PointerVarVector & get_variables() const noexcept
Getter for member variable Pointer::variables.
Definition: all.hpp:34955
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:35651
bool is_if_statement() const noexcept override
Check if the ast node is an instance of ast::IfStatement.
Definition: all.hpp:27795
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28452
const std::shared_ptr< Expression > & get_to() const noexcept
Getter for member variable TableStatement::to.
Definition: all.hpp:32723
std::vector< std::shared_ptr< ReadIonVar > > ReadIonVarVector
Definition: ast_decl.hpp:352
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7667
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23379
type of ast::MutexUnlock
std::shared_ptr< Expression > value
TODO.
Definition: all.hpp:21161
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4771
int value
Value of integer.
Definition: all.hpp:1399
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5744
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8019
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19918
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18049
Represents an integer variable.
Definition: all.hpp:1396
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12766
bool is_function_block() const noexcept override
Check if the ast node is an instance of ast::FunctionBlock.
Definition: all.hpp:11931
type of ast::IndexedName
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:15032
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:35085
ExpressionVector definitions
Vector of unit statements.
Definition: all.hpp:15647
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:38322
BinaryOp get_value() const noexcept
Getter for member variable BinaryOperator::value.
Definition: all.hpp:18457
const std::shared_ptr< Expression > & get_left_linxpression() const noexcept
Getter for member variable LinEquation::left_linxpression.
Definition: all.hpp:20502
std::vector< std::shared_ptr< PlotVar > > PlotVarVector
Definition: ast_decl.hpp:399
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:33873
std::shared_ptr< Identifier > name
Name of the variable (TODO)
Definition: all.hpp:31774
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:33389
PlotBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8466
const NodeVector & get_blocks() const noexcept
Getter for member variable Include::blocks.
Definition: all.hpp:24268
Represents a DESTRUCTOR block in the NMODL.
Definition: all.hpp:9279
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FromStatement::name.
Definition: all.hpp:26996
ParamAssign * clone() const override
Return a copy of the current node.
Definition: all.hpp:24446
const ElectrodeCurVarVector & get_currents() const noexcept
Getter for member variable ElectrodeCurrent::currents.
Definition: all.hpp:33914
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9769
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6034
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17335
const std::shared_ptr< Name > & get_name1() const noexcept
Getter for member variable PartialBoundary::name1.
Definition: all.hpp:29121
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30186
Represent SENS statement in NMODL.
Definition: all.hpp:30284
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12402
const std::shared_ptr< BABlock > & get_bablock() const noexcept
Getter for member variable AfterBlock::bablock.
Definition: all.hpp:14300
const std::shared_ptr< String > & get_value() const noexcept
Getter for member variable PrimeName::value.
Definition: all.hpp:2917
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9284
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4539
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23349
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21492
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16827
type of ast::BbcorePointerVar
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13397
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10335
virtual Statement * clone() const override
Return a copy of the current node.
Definition: all.hpp:256
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25495
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable PartialBlock::statement_block.
Definition: all.hpp:11411
std::shared_ptr< String > ontology_id
Ontology name.
Definition: all.hpp:36560
bool is_statement() const noexcept override
Check if the ast node is an instance of ast::Statement.
Definition: all.hpp:242
bool is_wrapped_expression() const noexcept override
Check if the ast node is an instance of ast::WrappedExpression.
Definition: all.hpp:38276
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29955
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23954
bool is_nonspecific() const noexcept override
Check if the ast node is an instance of ast::Nonspecific.
Definition: all.hpp:33564
bool is_constant_var() const noexcept override
Check if the ast node is an instance of ast::ConstantVar.
Definition: all.hpp:18074
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35184
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23131
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26671
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17114
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29452
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9150
std::shared_ptr< Unit > unit
Unit of the argument.
Definition: all.hpp:3660
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25515
const std::shared_ptr< QueueExpressionType > & get_qtype() const noexcept
Getter for member variable QueueStatement::qtype.
Definition: all.hpp:32166
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:27489
bool is_function_call() const noexcept override
Check if the ast node is an instance of ast::FunctionCall.
Definition: all.hpp:20675
std::shared_ptr< Expression > expression2
TODO.
Definition: all.hpp:31420
UnitState * clone() const override
Return a copy of the current node.
Definition: all.hpp:23091
ConstantStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:32353
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:21159
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22005
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11999
const std::shared_ptr< Integer > & get_value() const noexcept
Getter for member variable Define::value.
Definition: all.hpp:23993
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12694
const BbcorePointerVarVector & get_variables() const noexcept
Getter for member variable BbcorePointer::variables.
Definition: all.hpp:35211
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31871
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:668
bool is_discrete_block() const noexcept override
Check if the ast node is an instance of ast::DiscreteBlock.
Definition: all.hpp:10953
bool is_bbcore_pointer() const noexcept override
Check if the ast node is an instance of ast::BbcorePointer.
Definition: all.hpp:35109
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22641
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:36887
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6995
bool is_section_var() const noexcept override
Check if the ast node is an instance of ast::SectionVar.
Definition: all.hpp:5219
UnaryOperator op
TODO.
Definition: all.hpp:19835
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16031
Type to represent different block types for before/after block.
Definition: all.hpp:21922
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13702
NeuronBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:16270
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26656
std::vector< std::shared_ptr< BbcorePointerVar > > BbcorePointerVarVector
Definition: ast_decl.hpp:360
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:38585
bool is_model() const noexcept override
Check if the ast node is an instance of ast::Model.
Definition: all.hpp:23615
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:37219
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:17782
type of ast::Expression
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable Verbatim::statement.
Definition: all.hpp:35956
std::shared_ptr< Integer > length
Length in case of array.
Definition: all.hpp:25404
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1700
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3733
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2305
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Useion::name.
Definition: all.hpp:33322
Sens * clone() const override
Return a copy of the current node.
Definition: all.hpp:30327
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13675
std::shared_ptr< StatementBlock > finalize_block
Statement block to be executed after calling linear solver.
Definition: all.hpp:37851
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable PointerVar::name.
Definition: all.hpp:6060
const std::shared_ptr< Double > & get_max() const noexcept
Getter for member variable Limits::max.
Definition: all.hpp:17390
Represents the coreneuron nrn_state callback function.
Definition: all.hpp:37127
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ForAllStatement::statement_block.
Definition: all.hpp:27356
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:847
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:34284
std::shared_ptr< String > filename
path to the file to include
Definition: all.hpp:24124
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21763
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable VarName::name.
Definition: all.hpp:3480
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26600
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36157
bool is_range() const noexcept override
Check if the ast node is an instance of ast::Range.
Definition: all.hpp:34308
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19681
Represents a name.
Definition: all.hpp:2516
Represents a prime variable (for ODE)
Definition: all.hpp:2784
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27951
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21242
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29430
AfterBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:14197
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:36134
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:15459
MutexUnlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:29901
NameVector solvefor
Name of the integration method.
Definition: all.hpp:10582
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28149
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13587
BinaryOperator op
Operator.
Definition: all.hpp:19315
std::shared_ptr< Expression > expression1
TODO.
Definition: all.hpp:31418
type of ast::ProcedureBlock
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:35900
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7931
Represents BBCOREPOINTER statement in NMODL.
Definition: all.hpp:35080
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12944
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13002
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22880
type of ast::NumberRange
type of ast::BbcorePointer
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26365
const std::shared_ptr< Expression > & get_index() const noexcept
Getter for member variable VarName::index.
Definition: all.hpp:3506
bool is_define() const noexcept override
Check if the ast node is an instance of ast::Define.
Definition: all.hpp:23866
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23483
std::shared_ptr< String > title
TODO.
Definition: all.hpp:23588
bool is_compartment() const noexcept override
Check if the ast node is an instance of ast::Compartment.
Definition: all.hpp:30841
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:16227
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23138
const ExternVarVector & get_variables() const noexcept
Getter for member variable External::variables.
Definition: all.hpp:35459
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29055
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35922
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26693
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1778
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11344
type of ast::ThreadsafeVar
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6516
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21743
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:22440
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9161
ArgumentVector parameters
Parameters to the net receive block.
Definition: all.hpp:12632
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9093
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable PartialBoundary::name.
Definition: all.hpp:29082
int value
Value of boolean.
Definition: all.hpp:2248
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17604
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34396
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:38779
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30202
Reset * clone() const override
Return a copy of the current node.
Definition: all.hpp:30112
const AssignedDefinitionVector & get_definitions() const noexcept
Getter for member variable StateBlock::definitions.
Definition: all.hpp:8283
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9577
std::shared_ptr< Expression > reaction2
TODO.
Definition: all.hpp:31416
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32442
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4524
const WriteIonVarVector & get_writelist() const noexcept
Getter for member variable Useion::writelist.
Definition: all.hpp:33348
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable FunctionTableBlock::unit.
Definition: all.hpp:11742
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29865
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13017
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20530
Represents differential equation in DERIVATIVE block.
Definition: all.hpp:19597
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:37911
Integer * clone() const override
Return a copy of the current node.
Definition: all.hpp:1443
type of ast::QueueStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4799
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:37494
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable AssignedDefinition::unit.
Definition: all.hpp:25606
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32628
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable FromStatement::statement_block.
Definition: all.hpp:27048
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11315
SectionVarVector sections
Vector of section variables.
Definition: all.hpp:34034
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21262
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable PartialBoundary::expression.
Definition: all.hpp:29108
const std::shared_ptr< Number > & get_start() const noexcept
Getter for member variable IndependentDefinition::start.
Definition: all.hpp:25203
type of ast::UnaryExpression
bool is_protect_statement() const noexcept override
Check if the ast node is an instance of ast::ProtectStatement.
Definition: all.hpp:26625
DoubleUnit * clone() const override
Return a copy of the current node.
Definition: all.hpp:16795
type of ast::QueueExpressionType
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:15122
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8269
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21163
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6776
const std::shared_ptr< Name > & get_byname() const noexcept
Getter for member variable LagStatement::byname.
Definition: all.hpp:31918
type of ast::WhileStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9443
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ThreadsafeVar::name.
Definition: all.hpp:6802
BbcorePointer * clone() const override
Return a copy of the current node.
Definition: all.hpp:35123
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14258
bool is_update_dt() const noexcept override
Check if the ast node is an instance of ast::UpdateDt.
Definition: all.hpp:39007
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1227
bool is_match() const noexcept override
Check if the ast node is an instance of ast::Match.
Definition: all.hpp:21689
bool is_eigen_newton_solver_block() const noexcept override
Check if the ast node is an instance of ast::EigenNewtonSolverBlock.
Definition: all.hpp:37448
Represent LONGITUDINAL_DIFFUSION statement in NMODL.
Definition: all.hpp:31108
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28692
std::vector< std::shared_ptr< IndependentDefinition > > IndependentDefinitionVector
Definition: ast_decl.hpp:426
bool is_unit() const noexcept override
Check if the ast node is an instance of ast::Unit.
Definition: all.hpp:16532
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19980
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33639
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7394
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:39095
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9959
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:36149
type of ast::PartialEquation
ElseIfStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:28132
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35680
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34177
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3935
const std::shared_ptr< PrimeName > & get_prime() const noexcept
Getter for member variable PartialEquation::prime.
Definition: all.hpp:28734
Stepped * clone() const override
Return a copy of the current node.
Definition: all.hpp:24769
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16812
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11014
NameVector depend_vars
dependent variables
Definition: all.hpp:32549
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12482
const std::shared_ptr< Valence > & get_valence() const noexcept
Getter for member variable Useion::valence.
Definition: all.hpp:33361
Represents a boolean variable.
Definition: all.hpp:2245
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30872
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9454
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10716
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:38350
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17525
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32983
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5774
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23123
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22528
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15129
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15429
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20721
bool is_terminal_block() const noexcept override
Check if the ast node is an instance of ast::TerminalBlock.
Definition: all.hpp:13614
QueueType get_value() const noexcept
Getter for member variable QueueExpressionType::value.
Definition: all.hpp:21534
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3174
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7678
std::shared_ptr< VarName > name
TODO.
Definition: all.hpp:3933
type of ast::Compartment
LagStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:31817
BABlockType * clone() const override
Return a copy of the current node.
Definition: all.hpp:21965
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23912
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:13585
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9649
std::shared_ptr< Name > del2
TODO.
Definition: all.hpp:28936
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28186
AssignedDefinitionVector definitions
Vector of assigned variables.
Definition: all.hpp:7800
type of ast::LagStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:37246
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable FactorDef::value.
Definition: all.hpp:22587
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21997
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23934
bool is_sens() const noexcept override
Check if the ast node is an instance of ast::Sens.
Definition: all.hpp:30313
const std::shared_ptr< Integer > & get_order() const noexcept
Getter for member variable PrimeName::order.
Definition: all.hpp:2930
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:35971
NonspecificCurVarVector currents
Vector of non specific variables.
Definition: all.hpp:33538
NameVector names
TODO.
Definition: all.hpp:31115
Section * clone() const override
Return a copy of the current node.
Definition: all.hpp:34074
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30929
bool is_external() const noexcept override
Check if the ast node is an instance of ast::External.
Definition: all.hpp:35357
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31778
ThreadSafe * clone() const override
Return a copy of the current node.
Definition: all.hpp:35619
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26092
type of ast::Identifier
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10003
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7025
type of ast::PlotDeclaration
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:33652
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7312
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27826
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18585
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18641
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2051
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:37983
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4292
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27863
const std::shared_ptr< PlotVar > & get_name() const noexcept
Getter for member variable PlotDeclaration::name.
Definition: all.hpp:25949
type of ast::SectionVar
GlobalVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5727
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13980
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ExternVar::name.
Definition: all.hpp:6555
bool is_float() const noexcept override
Check if the ast node is an instance of ast::Float.
Definition: all.hpp:1724
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7354
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:35403
const NameVector & get_solvefor() const noexcept
Getter for member variable NonLinearBlock::solvefor.
Definition: all.hpp:10755
bool is_unit_block() const noexcept override
Check if the ast node is an instance of ast::UnitBlock.
Definition: all.hpp:15675
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:33858
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:33929
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30129
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27547
Represents CONDUCTANCE statement in NMODL.
Definition: all.hpp:26085
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32960
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19418
bool is_pointer_var() const noexcept override
Check if the ast node is an instance of ast::PointerVar.
Definition: all.hpp:5960
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:28364
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21234
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1490
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11021
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4453
bool is_plot_var() const noexcept override
Check if the ast node is an instance of ast::PlotVar.
Definition: all.hpp:17811
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21422
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13153
virtual Expression * clone() const override
Return a copy of the current node.
Definition: all.hpp:437
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:22438
WriteIonVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4492
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29991
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:36618
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16388
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3228
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10430
type of ast::ParenExpression
std::shared_ptr< Number > to
TODO.
Definition: all.hpp:25408
const std::shared_ptr< Expression > & get_linxpression() const noexcept
Getter for member variable LinEquation::linxpression.
Definition: all.hpp:20515
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:16752
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32650
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30632
StepBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7265
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15743
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ElectrodeCurVar::name.
Definition: all.hpp:5072
const ConstantStatementVector & get_statements() const noexcept
Getter for member variable ConstantBlock::statements.
Definition: all.hpp:16080
SolveBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12985
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19398
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18826
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10096
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23151
PlotDeclaration * clone() const override
Return a copy of the current node.
Definition: all.hpp:25848
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16344
PrimeName * clone() const override
Return a copy of the current node.
Definition: all.hpp:2831
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19067
DestructorBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9325
Name * clone() const override
Return a copy of the current node.
Definition: all.hpp:2561
const std::shared_ptr< ConstantVar > & get_constant() const noexcept
Getter for member variable ConstantStatement::constant.
Definition: all.hpp:32427
Represent NEURON block in the mod file.
Definition: all.hpp:16224
std::shared_ptr< Name > conductance
Conductance variable.
Definition: all.hpp:26088
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:27764
PointerVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5974
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23927
std::shared_ptr< String > ontology_id
Ontology to indicate the chemical ion.
Definition: all.hpp:33181
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1212
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8795
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16095
std::shared_ptr< Name > name3
TODO.
Definition: all.hpp:28619
std::shared_ptr< Identifier > name
Name of the variable.
Definition: all.hpp:25402
bool is_solve_block() const noexcept override
Check if the ast node is an instance of ast::SolveBlock.
Definition: all.hpp:12971
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6501
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22322
NameVector solvefor
Solve for specification (TODO)
Definition: all.hpp:15030
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:2189
bool is_var_name() const noexcept override
Check if the ast node is an instance of ast::VarName.
Definition: all.hpp:3380
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8513
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4006
const StatementVector & get_statements() const noexcept
Getter for member variable StatementBlock::statements.
Definition: all.hpp:9754
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:37941
bool is_net_receive_block() const noexcept override
Check if the ast node is an instance of ast::NetReceiveBlock.
Definition: all.hpp:12663
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32152
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21549
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9357
std::shared_ptr< Name > name1
TODO.
Definition: all.hpp:28615
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7610
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31891
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24809
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25416
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1901
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14900
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5334
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2878
const std::shared_ptr< SolveBlock > & get_solve_block() const noexcept
Getter for member variable SolutionExpression::solve_block.
Definition: all.hpp:38836
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ProcedureBlock::name.
Definition: all.hpp:12428
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29654
const std::shared_ptr< Number > & get_max() const noexcept
Getter for member variable NumberRange::max.
Definition: all.hpp:17651
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27883
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8234
GlobalVarVector variables
Vector of global variables.
Definition: all.hpp:34531
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:34036
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7596
Base class for all block scoped nodes.
Definition: all.hpp:580
const std::shared_ptr< StatementBlock > & get_initialize_block() const noexcept
Getter for member variable EigenLinearSolverBlock::initialize_block.
Definition: all.hpp:38023
std::shared_ptr< Expression > node_to_solve
Block to be solved (callback node or solution node itself)
Definition: all.hpp:38721
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:24728
bool is_write_ion_var() const noexcept override
Check if the ast node is an instance of ast::WriteIonVar.
Definition: all.hpp:4478
std::string eval() const
Return value of the ast node.
Definition: all.hpp:2202
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13439
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30430
bool is_include() const noexcept override
Check if the ast node is an instance of ast::Include.
Definition: all.hpp:24153
std::shared_ptr< Integer > index
TODO.
Definition: all.hpp:17784
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17350
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NetReceiveBlock::statement_block.
Definition: all.hpp:12793
type of ast::DerivimplicitCallback
type of ast::TableStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8298
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30694
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13046
type of ast::NonLinEquation
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26205
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32385
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3662
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable LinearBlock::statement_block.
Definition: all.hpp:10415
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3146
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5192
PartialBoundary * clone() const override
Return a copy of the current node.
Definition: all.hpp:28981
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21249
std::vector< std::shared_ptr< NonspecificCurVar > > NonspecificCurVarVector
Definition: ast_decl.hpp:354
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3131
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11618
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11904
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1141
bool is_indexed_name() const noexcept override
Check if the ast node is an instance of ast::IndexedName.
Definition: all.hpp:3100
ForNetcon * clone() const override
Return a copy of the current node.
Definition: all.hpp:14769
bool is_mutex_unlock() const noexcept override
Check if the ast node is an instance of ast::MutexUnlock.
Definition: all.hpp:29887
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5686
std::vector< std::shared_ptr< ElectrodeCurVar > > ElectrodeCurVarVector
Definition: ast_decl.hpp:355
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26913
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22255
type of ast::DestructorBlock
virtual std::string get_node_name() const
Return name of of the node.
Definition: ast.cpp:29
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10999
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable KineticBlock::statement_block.
Definition: all.hpp:15216
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable QueueStatement::name.
Definition: all.hpp:32179
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13960
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30652
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1503
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7896
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22850
BAType value
block type
Definition: all.hpp:21925
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12374
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15092
type of ast::AssignedBlock
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ProcedureBlock::unit.
Definition: all.hpp:12454
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8989
bool is_diff_eq_expression() const noexcept override
Check if the ast node is an instance of ast::DiffEqExpression.
Definition: all.hpp:19627
const std::shared_ptr< Expression > & get_from() const noexcept
Getter for member variable FromStatement::from.
Definition: all.hpp:27009
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13382
std::shared_ptr< Name > type
TODO.
Definition: all.hpp:22790
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1798
FromStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26896
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7052
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:35170
Program * clone() const override
Return a copy of the current node.
Definition: all.hpp:36855
const std::shared_ptr< String > & get_ontology_id() const noexcept
Getter for member variable OntologyStatement::ontology_id.
Definition: all.hpp:36689
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4305
type of ast::ConstructorBlock
const NameVector & get_table_vars() const noexcept
Getter for member variable TableStatement::table_vars.
Definition: all.hpp:32684
const MatchVector & get_matchs() const noexcept
Getter for member variable MatchBlock::matchs.
Definition: all.hpp:15515
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1980
std::string eval() const
Return enum value in string form.
Definition: all.hpp:21617
const std::shared_ptr< StatementBlock > & get_initialize_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::initialize_block.
Definition: all.hpp:37591
const NodeVector & get_blocks() const noexcept
Getter for member variable Program::blocks.
Definition: all.hpp:36998
StatementVector statements
Vector of statements.
Definition: all.hpp:9575
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33632
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:14858
RangeVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5480
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:16317
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26192
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9974
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17086
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Suffix::name.
Definition: all.hpp:33042
BbcorePointerVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:6222
std::shared_ptr< Name > name2
TODO.
Definition: all.hpp:28617
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:37853
AssignedBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7842
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13411
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13367
type of ast::BinaryExpression
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10085
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:38379
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14024
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:35929
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15486
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19138
std::shared_ptr< Integer > with
TODO.
Definition: all.hpp:25019
bool is_ba_block_type() const noexcept override
Check if the ast node is an instance of ast::BABlockType.
Definition: all.hpp:21951
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19473
ReactVarName * clone() const override
Return a copy of the current node.
Definition: all.hpp:3974
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable RangeVar::name.
Definition: all.hpp:5566
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5087
type of ast::BinaryOperator
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7638
UpdateDt * clone() const override
Return a copy of the current node.
Definition: all.hpp:39021
Argument * clone() const override
Return a copy of the current node.
Definition: all.hpp:3701
MatchVector matchs
Vector of match statements.
Definition: all.hpp:15370
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1827
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ExpressionStatement::expression.
Definition: all.hpp:26478
type of ast::ThreadSafe
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable IndexedName::name.
Definition: all.hpp:3200
Represents ELECTRODE_CURRENT variables statement in NMODL.
Definition: all.hpp:33783
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18664
const std::shared_ptr< Integer > & get_at() const noexcept
Getter for member variable VarName::at.
Definition: all.hpp:3493
NodeVector blocks
AST of the included file.
Definition: all.hpp:24126
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30984
ParenExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:19106
Auto generated AST classes declaration.
std::shared_ptr< Name > method
Name of the integration method.
Definition: all.hpp:12938
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24241
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32314
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31493
type of ast::NetReceiveBlock
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7916
bool is_conductance_hint() const noexcept override
Check if the ast node is an instance of ast::ConductanceHint.
Definition: all.hpp:26117
Base class for all AST node.
Definition: all.hpp:44
TerminalBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:13628
FunctionBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11945
virtual ~Node()=default
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24884
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9901
std::shared_ptr< ElseStatement > elses
TODO.
Definition: all.hpp:27768
Base class for all numbers.
Definition: all.hpp:941
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29933
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:36930
bool is_breakpoint_block() const noexcept override
Check if the ast node is an instance of ast::BreakpointBlock.
Definition: all.hpp:13336
SteppedVector statements
Vector of statements.
Definition: all.hpp:7223
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable DoubleUnit::value.
Definition: all.hpp:16869
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15763
std::shared_ptr< Valence > valence
(TODO)
Definition: all.hpp:33179
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11977
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30887
bool is_param_block() const noexcept override
Check if the ast node is an instance of ast::ParamBlock.
Definition: all.hpp:6964
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13059
BlockComment * clone() const override
Return a copy of the current node.
Definition: all.hpp:36352
bool eval() const
Return value of the ast node.
Definition: all.hpp:2471
IndependentDefinitionVector definitions
TODO.
Definition: all.hpp:7507
std::shared_ptr< Name > macro
if integer is a macro then it&#39;s name
Definition: all.hpp:1401
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:24403
bool is_unit_def() const noexcept override
Check if the ast node is an instance of ast::UnitDef.
Definition: all.hpp:22194
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36902
type of ast::SolveBlock
bool is_watch_statement() const noexcept override
Check if the ast node is an instance of ast::WatchStatement.
Definition: all.hpp:29384
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30159
ConstantStatementVector statements
Vector of constant statements.
Definition: all.hpp:15935
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9379
type of ast::StatementBlock
std::vector< std::shared_ptr< Watch > > WatchVector
Definition: ast_decl.hpp:412
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11330
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9996
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16586
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31878
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:14035
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5194
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3441
Represents NONLINEAR block in the NMODL.
Definition: all.hpp:10577
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:35722
KineticBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:15075
std::string eval() const
Return enum value in string form.
Definition: all.hpp:19022
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28621
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20213
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17071
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable FunctionBlock::unit.
Definition: all.hpp:12086
BeforeBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:13906
const NameVector & get_solvefor() const noexcept
Getter for member variable KineticBlock::solvefor.
Definition: all.hpp:15203
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28437
ReactionStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:31461
Represents a double variable.
Definition: all.hpp:1975
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Watch::expression.
Definition: all.hpp:21276
StatementBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9617
EigenNewtonSolverBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:37462
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19938
bool is_unit_state() const noexcept override
Check if the ast node is an instance of ast::UnitState.
Definition: all.hpp:23077
std::shared_ptr< FirstLastTypeIndex > index
TODO.
Definition: all.hpp:28930
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30816
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NonLinearBlock::statement_block.
Definition: all.hpp:10768
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8241
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22520
bool is_binary_expression() const noexcept override
Check if the ast node is an instance of ast::BinaryExpression.
Definition: all.hpp:19344
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29764
ParamBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6978
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17885
StateBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8180
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21720
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:11900
bool is_independent_block() const noexcept override
Check if the ast node is an instance of ast::IndependentBlock.
Definition: all.hpp:7535
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10031
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8758
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5828
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18684
bool is_local_var() const noexcept override
Check if the ast node is an instance of ast::LocalVar.
Definition: all.hpp:17040
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:35693
bool is_solution_expression() const noexcept override
Check if the ast node is an instance of ast::SolutionExpression.
Definition: all.hpp:38748
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31173
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2521
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:16106
Represents NONSPECIFIC_CURRENT variables statement in NMODL.
Definition: all.hpp:33535
PointerVarVector variables
Vector of pointer variables.
Definition: all.hpp:34827
BAType
enum type to distinguish BEFORE or AFTER blocks
Definition: ast_common.hpp:92
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17927
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5512
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:37189
Represents a DEFINE statement in NMODL.
Definition: all.hpp:23834
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13757
Represents a STATE block in the NMODL.
Definition: all.hpp:8135
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable UpdateDt::value.
Definition: all.hpp:39109
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:34106
std::shared_ptr< Number > value
Value of the constant.
Definition: all.hpp:18045
static const std::string UnitStateTypeNames[]
string representation of ast::UnitStateType
Definition: ast_common.hpp:101
type of ast::EigenNewtonSolverBlock
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12724
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:36704
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2672
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7225
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:14554
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6262
const std::shared_ptr< BABlockType > & get_type() const noexcept
Getter for member variable BABlock::type.
Definition: all.hpp:14568
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8815
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:34603
const AssignedDefinitionVector & get_definitions() const noexcept
Getter for member variable AssignedBlock::definitions.
Definition: all.hpp:7993
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2377
type of ast::DiffEqExpression
type of ast::LineComment
const std::shared_ptr< Expression > & get_reaction1() const noexcept
Getter for member variable ReactionStatement::reaction1.
Definition: all.hpp:31549
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31230
bool is_factor_def() const noexcept override
Check if the ast node is an instance of ast::FactorDef.
Definition: all.hpp:22474
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27577
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13424
WatchVector::const_iterator insert_watch(WatchVector::const_iterator position, const std::shared_ptr< Watch > &n)
Insert member to statements.
Definition: ast.cpp:12219
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:33540
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2036
bool is_from_statement() const noexcept override
Check if the ast node is an instance of ast::FromStatement.
Definition: all.hpp:26882
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22225
std::shared_ptr< Double > abstol
TODO.
Definition: all.hpp:25414
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16855
std::vector< std::shared_ptr< Expression > > ExpressionVector
Definition: ast_decl.hpp:337
bool is_valence() const noexcept override
Check if the ast node is an instance of ast::Valence.
Definition: all.hpp:22819
std::shared_ptr< Name > ion
Ion name.
Definition: all.hpp:26090
std::vector< std::shared_ptr< Stepped > > SteppedVector
Definition: ast_decl.hpp:425
bool is_local_list_statement() const noexcept override
Check if the ast node is an instance of ast::LocalListStatement.
Definition: all.hpp:23318
std::shared_ptr< Name > name
Name of the function.
Definition: all.hpp:11896
std::shared_ptr< Name > del
TODO.
Definition: all.hpp:28926
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24184
std::shared_ptr< Limits > limit
TODO.
Definition: all.hpp:24405
Represents THREADSAFE statement in NMODL.
Definition: all.hpp:35576
NetReceiveBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12677
bool is_derivative_block() const noexcept override
Check if the ast node is an instance of ast::DerivativeBlock.
Definition: all.hpp:9928
std::shared_ptr< Number > max
TODO.
Definition: all.hpp:17523
bool is_node() const noexcept override
Check if the ast node is an instance of ast::Node.
Definition: all.hpp:66
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11560
BbcorePointerVarVector variables
Vector of bbcore pointer variables.
Definition: all.hpp:35083
ExpressionVector arguments
TODO.
Definition: all.hpp:20648
bool is_step_block() const noexcept override
Check if the ast node is an instance of ast::StepBlock.
Definition: all.hpp:7251
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2250
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:6428
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31849
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23897
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:13307
bool is_string() const noexcept override
Check if the ast node is an instance of ast::String.
Definition: all.hpp:1166
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25880
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:26855
const std::shared_ptr< Limits > & get_limit() const noexcept
Getter for member variable ParamAssign::limit.
Definition: all.hpp:24571
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8506
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24730
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:21662
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6014
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19925
std::shared_ptr< StatementBlock > setup_x_block
update X from states
Definition: all.hpp:37847
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25634
std::shared_ptr< Boolean > gt
Todo: Michael : rename variable gt as well.
Definition: all.hpp:22444
bool is_paren_expression() const noexcept override
Check if the ast node is an instance of ast::ParenExpression.
Definition: all.hpp:19092
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20375
Represents CURIE information in NMODL.
Definition: all.hpp:36557
bool is_after_block() const noexcept override
Check if the ast node is an instance of ast::AfterBlock.
Definition: all.hpp:14183
std::vector< std::shared_ptr< AssignedDefinition > > AssignedDefinitionVector
Definition: ast_decl.hpp:427
std::string eval() const
Return enum value in string form.
Definition: all.hpp:18781
ForAllStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:27255
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30401
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10328
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15721
const std::shared_ptr< Number > & get_to() const noexcept
Getter for member variable IndependentDefinition::to.
Definition: all.hpp:25177
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7859
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable IndependentDefinition::name.
Definition: all.hpp:25151
const std::shared_ptr< Expression > & get_from() const noexcept
Getter for member variable TableStatement::from.
Definition: all.hpp:32710
Represents a multi-line comment in NMODL.
Definition: all.hpp:36308
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:817
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19839
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable NetReceiveBlock::parameters.
Definition: all.hpp:12780
const std::shared_ptr< Double > & get_abstol() const noexcept
Getter for member variable AssignedDefinition::abstol.
Definition: all.hpp:25619
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10233
const std::shared_ptr< Expression > & get_expression1() const noexcept
Getter for member variable ReactionStatement::expression1.
Definition: all.hpp:31588
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8212
std::shared_ptr< Name > name
Name of the kinetic block.
Definition: all.hpp:15028
std::shared_ptr< Expression > from
from value
Definition: all.hpp:32551
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7297
const std::shared_ptr< Name > & get_macro() const noexcept
Getter for member variable Integer::macro.
Definition: all.hpp:1530
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16897
std::vector< std::shared_ptr< SectionVar > > SectionVarVector
Definition: ast_decl.hpp:356
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10701
bool is_thread_safe() const noexcept override
Check if the ast node is an instance of ast::ThreadSafe.
Definition: all.hpp:35605
bool is_eigen_linear_solver_block() const noexcept override
Check if the ast node is an instance of ast::EigenLinearSolverBlock.
Definition: all.hpp:37880
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15444
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24228
const std::shared_ptr< Expression > & get_rhs() const noexcept
Getter for member variable NonLinEquation::rhs.
Definition: all.hpp:20240
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:38794
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18671
bool is_table_statement() const noexcept override
Check if the ast node is an instance of ast::TableStatement.
Definition: all.hpp:32582
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7802
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18925
const std::shared_ptr< StatementBlock > & get_setup_x_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::setup_x_block.
Definition: all.hpp:37604
type of ast::AfterBlock
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable LocalVar::name.
Definition: all.hpp:17140
std::shared_ptr< Name > name
Name of the function table block.
Definition: all.hpp:11554
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30344
std::shared_ptr< Expression > index
index value in case of array
Definition: all.hpp:3353
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:35636
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27562
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1908
const ReactionOperator & get_op() const noexcept
Getter for member variable ReactionStatement::op.
Definition: all.hpp:31562
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9692
std::string eval() const
Return value of the ast node.
Definition: all.hpp:1921
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20999
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable TerminalBlock::statement_block.
Definition: all.hpp:13731
std::shared_ptr< String > name
TODO.
Definition: all.hpp:16505
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:25895
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22794
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18120
bool is_else_statement() const noexcept override
Check if the ast node is an instance of ast::ElseStatement.
Definition: all.hpp:28391
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11690
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable LinearBlock::name.
Definition: all.hpp:10389
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:36406
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34128
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4346
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2320
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20100
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16647
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Compartment::name.
Definition: all.hpp:30943
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14526
Conserve * clone() const override
Return a copy of the current node.
Definition: all.hpp:30578
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9086
ExternVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:6469
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15107
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15750
std::shared_ptr< Identifier > name
Name of the variable.
Definition: all.hpp:32051
Base class for all identifiers.
Definition: all.hpp:764
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20193
UnitBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:15689
ElseIfStatementVector elseifs
TODO.
Definition: all.hpp:27766
std::shared_ptr< Number > value
TODO.
Definition: all.hpp:24401
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22025
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:39075
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22240
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:36078
const std::shared_ptr< Block > & get_node_to_solve() const noexcept
Getter for member variable DerivimplicitCallback::node_to_solve.
Definition: all.hpp:38599
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9414
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14519
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17666
std::shared_ptr< Name > type
type of channel
Definition: all.hpp:32900
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:34339
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21982
std::shared_ptr< StatementBlock > initialize_block
Statement block to be executed before calling linear solver.
Definition: all.hpp:37845
const std::shared_ptr< Expression > & get_node_to_solve() const noexcept
Getter for member variable SolutionExpression::node_to_solve.
Definition: all.hpp:38849
const std::shared_ptr< Name > & get_del() const noexcept
Getter for member variable PartialBoundary::del.
Definition: all.hpp:29069
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1014
bool is_reaction_statement() const noexcept override
Check if the ast node is an instance of ast::ReactionStatement.
Definition: all.hpp:31447
const std::shared_ptr< ElseStatement > & get_elses() const noexcept
Getter for member variable IfStatement::elses.
Definition: all.hpp:27936
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7889
const std::shared_ptr< BinaryExpression > & get_expression() const noexcept
Getter for member variable DiffEqExpression::expression.
Definition: all.hpp:19715
bool is_prime_name() const noexcept override
Check if the ast node is an instance of ast::PrimeName.
Definition: all.hpp:2817
type of ast::Argument
std::string eval() const
Return value of the ast node.
Definition: all.hpp:1346
Represents block encapsulating list of statements.
Definition: all.hpp:9572
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Compartment::expression.
Definition: all.hpp:30956
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18105
Abstract base class for all constant visitors implementation.
Definition: visitor.hpp:336
std::shared_ptr< Expression > linxpression
TODO.
Definition: all.hpp:20373
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16835
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16563
Represent RESET statement in NMODL.
Definition: all.hpp:30073
type of ast::IfStatement
type of ast::ParamAssign
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2945
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:37948
type of ast::FunctionTableBlock
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7903
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:39124
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18423
const std::shared_ptr< Name > & get_name3() const noexcept
Getter for member variable PartialBoundary::name3.
Definition: all.hpp:29160
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34383
bool is_suffix() const noexcept override
Check if the ast node is an instance of ast::Suffix.
Definition: all.hpp:32929
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6733
type of ast::TerminalBlock
NrnStateBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:37172
ProcedureBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12313
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7874
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable BABlock::statement_block.
Definition: all.hpp:14581
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20729
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34928
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14801
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:38330
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:31111
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7581
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3521
const std::shared_ptr< Name > & get_method() const noexcept
Getter for member variable SolveBlock::method.
Definition: all.hpp:13101
SolutionExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:38762
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10586
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6817
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30610
bool is_lon_difuse() const noexcept override
Check if the ast node is an instance of ast::LonDifuse.
Definition: all.hpp:31142
virtual void visit_children(visitor::Visitor &v) override
visit children i.e.
Definition: ast.cpp:361
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27287
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26247
type of ast::OntologyStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28206
NumberRange * clone() const override
Return a copy of the current node.
Definition: all.hpp:17564
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4698
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13865
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13142
bool is_plot_block() const noexcept override
Check if the ast node is an instance of ast::PlotBlock.
Definition: all.hpp:8452
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14843
MutexLock * clone() const override
Return a copy of the current node.
Definition: all.hpp:29690
type of ast::BlockComment
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16051
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:35942
bool is_program() const noexcept override
Check if the ast node is an instance of ast::Program.
Definition: all.hpp:36841
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5293
const std::shared_ptr< Boolean > & get_sweep() const noexcept
Getter for member variable IndependentDefinition::sweep.
Definition: all.hpp:25138
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18656
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable WhileStatement::statement_block.
Definition: all.hpp:27631
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10644
std::shared_ptr< Expression > to
to values
Definition: all.hpp:32553
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25964
const ExpressionVector & get_definitions() const noexcept
Getter for member variable UnitBlock::definitions.
Definition: all.hpp:15792
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable SectionVar::name.
Definition: all.hpp:5319
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13479
const std::shared_ptr< Number > & get_start() const noexcept
Getter for member variable AssignedDefinition::start.
Definition: all.hpp:25593
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24506
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4206
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23683
std::shared_ptr< Unit > unit1
TODO.
Definition: all.hpp:22442
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable DerivativeBlock::name.
Definition: all.hpp:10057
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30625
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32657
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10584
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:39053
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34376
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29751
type of ast::DerivativeBlock
bool is_read_ion_var() const noexcept override
Check if the ast node is an instance of ast::ReadIonVar.
Definition: all.hpp:4231
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10924
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable GlobalVar::name.
Definition: all.hpp:5813
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13689
const std::shared_ptr< Expression > & get_lhs() const noexcept
Getter for member variable NonLinEquation::lhs.
Definition: all.hpp:20227
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34722
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24816
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:484
const BinaryOperator & get_op() const noexcept
Getter for member variable BinaryExpression::op.
Definition: all.hpp:19445
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:27762
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2621
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable LonDifuse::expression.
Definition: all.hpp:31257
std::shared_ptr< BinaryExpression > expression
Differential Expression.
Definition: all.hpp:19600
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:11902
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34941
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11962
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10231
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29175
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20803
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:11556
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:24724
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21500
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11655
const NameVector & get_names() const noexcept
Getter for member variable LonDifuse::names.
Definition: all.hpp:31270
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12034
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32670
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17155
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9634
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:33003
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11757
ReactionOp value
TODO.
Definition: all.hpp:18824
std::shared_ptr< Name > name
Name of ion.
Definition: all.hpp:33173
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21006
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22893
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:35915
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29013
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19153
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13074
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10306
type of ast::ReactionOperator
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:14607
BinaryOp value
Operator.
Definition: all.hpp:18342
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6254
const std::shared_ptr< Expression > & get_expression2() const noexcept
Getter for member variable ReactionStatement::expression2.
Definition: all.hpp:31601
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:35333
std::shared_ptr< Name > name3
TODO.
Definition: all.hpp:28940
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5527
ElectrodeCurrent * clone() const override
Return a copy of the current node.
Definition: all.hpp:33826
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7623
bool is_state_block() const noexcept override
Check if the ast node is an instance of ast::StateBlock.
Definition: all.hpp:8166
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22505
Nonspecific * clone() const override
Return a copy of the current node.
Definition: all.hpp:33578
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25922
static const std::string QueueTypeNames[]
string representation of ast::QueueType
Definition: ast_common.hpp:89
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30076
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16606
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8526
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:37421
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9079
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable ProcedureBlock::parameters.
Definition: all.hpp:12441
std::shared_ptr< Integer > n_state_vars
number of state vars used in solve
Definition: all.hpp:37841
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2066
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:15778
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8870
Represents EXTERNAL statement in NMODL.
Definition: all.hpp:35328
std::string eval() const
Return enum value in string form.
Definition: all.hpp:21116
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17611
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11242
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15149
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8197
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable Stepped::unit.
Definition: all.hpp:24869
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable WhileStatement::condition.
Definition: all.hpp:27618
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4532
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25104
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33887
const std::shared_ptr< Expression > & get_increment() const noexcept
Getter for member variable FromStatement::increment.
Definition: all.hpp:27035
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:33183
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31217
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:15541
static const std::string UnaryOpNames[]
string representation of ast::UnaryOp
Definition: ast_common.hpp:77
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9399
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18135
bool is_bbcore_pointer_var() const noexcept override
Check if the ast node is an instance of ast::BbcorePointerVar.
Definition: all.hpp:6208
std::shared_ptr< BABlock > bablock
Block to be called before.
Definition: all.hpp:13863
bool is_for_all_statement() const noexcept override
Check if the ast node is an instance of ast::ForAllStatement.
Definition: all.hpp:27241
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30289
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:34899
type of ast::ElectrodeCurVar
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23386
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ConstantVar::unit.
Definition: all.hpp:18200
std::shared_ptr< Name > name
Name of the variable.
Definition: all.hpp:18043
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12493
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29722
BinaryOp
enum Type for binary operators in NMODL
Definition: ast_common.hpp:47
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23841
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:38251
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29744
std::shared_ptr< Double > min
TODO.
Definition: all.hpp:17260
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:112
const std::string & get_value() const noexcept
Getter for member variable Float::value.
Definition: all.hpp:1812
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30902
virtual void set_name(const std::string &name)
Set name for the AST node.
Definition: ast.cpp:47
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:27212
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28093
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:35226
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25081
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable WrappedExpression::expression.
Definition: all.hpp:38364
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable BlockComment::statement.
Definition: all.hpp:36440
bool is_plot_declaration() const noexcept override
Check if the ast node is an instance of ast::PlotDeclaration.
Definition: all.hpp:25834
const ReadIonVarVector & get_readlist() const noexcept
Getter for member variable Useion::readlist.
Definition: all.hpp:33335
std::shared_ptr< StatementBlock > variable_block
Statements to be declared in the functor.
Definition: all.hpp:37409
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:37536
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4593
type of ast::WatchStatement
const std::shared_ptr< BABlock > & get_bablock() const noexcept
Getter for member variable BeforeBlock::bablock.
Definition: all.hpp:14009
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:37204
const NameVector & get_names() const noexcept
Getter for member variable Compartment::names.
Definition: all.hpp:30969
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11437
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27856
int get_value() const noexcept
Getter for member variable Integer::value.
Definition: all.hpp:1517
std::shared_ptr< Number > start
TODO.
Definition: all.hpp:25410
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17857
Represent COMPARTMENT statement in NMODL.
Definition: all.hpp:30807
bool is_statement_block() const noexcept override
Check if the ast node is an instance of ast::StatementBlock.
Definition: all.hpp:9603
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14823
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable ParamAssign::name.
Definition: all.hpp:24532
bool is_boolean() const noexcept override
Check if the ast node is an instance of ast::Boolean.
Definition: all.hpp:2274
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20156
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19405
Model * clone() const override
Return a copy of the current node.
Definition: all.hpp:23629
std::shared_ptr< Unit > unit2
TODO.
Definition: all.hpp:22446
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27302
const std::shared_ptr< StatementBlock > & get_variable_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::variable_block.
Definition: all.hpp:37578
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27329
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31616
UnitStateType get_value() const noexcept
Getter for member variable UnitState::value.
Definition: all.hpp:23165
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:37233
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28677
const std::shared_ptr< Expression > & get_rhs() const noexcept
Getter for member variable BinaryExpression::rhs.
Definition: all.hpp:19458
UnaryExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:19878
LonDifuse * clone() const override
Return a copy of the current node.
Definition: all.hpp:31156
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26163
std::string eval() const
Return enum value in string form.
Definition: all.hpp:18540
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionBlock::name.
Definition: all.hpp:12060
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:20646
Represents a statement in ASSIGNED or STATE block.
Definition: all.hpp:25399
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:35885
type of ast::IndependentDefinition
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22873
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27063
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7326
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:14436
Statement to indicate a change in timestep in a given block.
Definition: all.hpp:38977
static const std::string FirstLastTypeNames[]
string representation of ast::FirstLastType
Definition: ast_common.hpp:83
std::shared_ptr< BABlockType > type
Type of NMODL block.
Definition: all.hpp:14434
Unit * clone() const override
Return a copy of the current node.
Definition: all.hpp:16546
NameVector names
TODO.
Definition: all.hpp:30814
bool is_unary_expression() const noexcept override
Check if the ast node is an instance of ast::UnaryExpression.
Definition: all.hpp:19864
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14438
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:127
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:24399
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10291
const std::string & get_value() const noexcept
Getter for member variable Double::value.
Definition: all.hpp:2093
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8483
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8227
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6282
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21927
PartialBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11283
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:36915
Represents a variable in the ast::ConstantBlock.
Definition: all.hpp:18040
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31535
Suffix * clone() const override
Return a copy of the current node.
Definition: all.hpp:32943
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30595
int get_value() const noexcept
Getter for member variable Boolean::value.
Definition: all.hpp:2362
bool is_constant_block() const noexcept override
Check if the ast node is an instance of ast::ConstantBlock.
Definition: all.hpp:15963
type of ast::LinEquation
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19195
std::shared_ptr< Name > name2
TODO.
Definition: all.hpp:28938
type of ast::FirstLastTypeIndex
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6486
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2108
std::shared_ptr< StatementBlock > finalize_block
Statement block to be executed after calling newton solver.
Definition: all.hpp:37419
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable Argument::name.
Definition: all.hpp:3787
WrappedExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:38290
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22865
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34625
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20749
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8254
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3075
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30909
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6756
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable BreakpointBlock::statement_block.
Definition: all.hpp:13453
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16578
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3815
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:39082
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26493
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27272
UnitDef * clone() const override
Return a copy of the current node.
Definition: all.hpp:22208
bool is_argument() const noexcept override
Check if the ast node is an instance of ast::Argument.
Definition: all.hpp:3687
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20488
ConstantVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:18088
std::shared_ptr< Expression > rhs
TODO.
Definition: all.hpp:20098
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1630
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31188
symtab::ModelSymbolTable model_symtab
global symbol table for model
Definition: all.hpp:36816
Represents a PARAMETER block in the NMODL.
Definition: all.hpp:6933
type of ast::KineticBlock
bool is_integer() const noexcept override
Check if the ast node is an instance of ast::Integer.
Definition: all.hpp:1429
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:288
bool is_first_last_type_index() const noexcept override
Check if the ast node is an instance of ast::FirstLastTypeIndex.
Definition: all.hpp:20945
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Match::expression.
Definition: all.hpp:21790
QueueExpressionType * clone() const override
Return a copy of the current node.
Definition: all.hpp:21460
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15649
type of ast::SolutionExpression
bool is_mutex_lock() const noexcept override
Check if the ast node is an instance of ast::MutexLock.
Definition: all.hpp:29676
const std::shared_ptr< Expression > & get_lhs() const noexcept
Getter for member variable BinaryExpression::lhs.
Definition: all.hpp:19432
std::shared_ptr< Name > byname
Name of the variable (TODO)
Definition: all.hpp:31776
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ElseIfStatement::statement_block.
Definition: all.hpp:28233
int eval() const
Return value of the ast node.
Definition: all.hpp:1650
virtual double to_double()
Definition: all.hpp:958
StatementVector::const_iterator insert_statement(StatementVector::const_iterator position, const std::shared_ptr< Statement > &n)
Insert member to statements.
Definition: ast.cpp:3425
type of ast::Statement
std::string eval() const
Return enum value in string form.
Definition: all.hpp:23248
bool is_conserve() const noexcept override
Check if the ast node is an instance of ast::Conserve.
Definition: all.hpp:30564
std::shared_ptr< Expression > rhs
RHS of the binary expression.
Definition: all.hpp:19317
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15473
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:37955
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28422
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11426
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18905
Represents a PLOT statement in the NMODL.
Definition: all.hpp:8420
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31834
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13468
virtual Node * clone() const override
Return a copy of the current node.
Definition: all.hpp:80
Represents a INDEPENDENT block in the NMODL.
Definition: all.hpp:7504
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24486
std::vector< std::shared_ptr< ConstantStatement > > ConstantStatementVector
Definition: ast_decl.hpp:451
bool is_function_table_block() const noexcept override
Check if the ast node is an instance of ast::FunctionTableBlock.
Definition: all.hpp:11587
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5441
bool is_expression_statement() const noexcept override
Check if the ast node is an instance of ast::ExpressionStatement.
Definition: all.hpp:26390
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22268
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18400
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9049
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:34354
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13953
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3454
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10794
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8309
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26742
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13645
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16009
Represent MUTEXUNLOCK statement in NMODL.
Definition: all.hpp:29862
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27646
UnitStateType
enum type used for UNIT_ON or UNIT_OFF state
Definition: ast_common.hpp:98
DiscreteBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10967
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:36648
DiffEqExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:19641
Represents USEION statement in NMODL.
Definition: all.hpp:33170
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18954
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29445
bool is_assigned_block() const noexcept override
Check if the ast node is an instance of ast::AssignedBlock.
Definition: all.hpp:7828
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14271
std::vector< std::shared_ptr< WriteIonVar > > WriteIonVarVector
Definition: ast_decl.hpp:353
Represent WATCH statement in NMODL.
Definition: all.hpp:29355
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12636
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20255
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21664
type of ast::ElectrodeCurrent
std::shared_ptr< Number > to
TODO.
Definition: all.hpp:25017
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8008
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:477
const PlotVarVector & get_variables() const noexcept
Getter for member variable PlotDeclaration::variables.
Definition: all.hpp:25936
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14496
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6529
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:21660
std::shared_ptr< Name > name
Name of the partial block.
Definition: all.hpp:11238
bool is_range_var() const noexcept override
Check if the ast node is an instance of ast::RangeVar.
Definition: all.hpp:5466
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17596
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2348
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13309
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1483
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:37226
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:36675
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1545
bool is_ontology_statement() const noexcept override
Check if the ast node is an instance of ast::OntologyStatement.
Definition: all.hpp:36587
type of ast::AssignedDefinition
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:12268
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable PartialBlock::name.
Definition: all.hpp:11398
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:37926
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:22792
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:33843
InitialBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8741
SectionVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5233
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11056
Represent newton solver solution block based on Eigen.
Definition: all.hpp:37404
const std::shared_ptr< Name > & get_del2() const noexcept
Getter for member variable PartialBoundary::del2.
Definition: all.hpp:29134
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1755
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15706
std::shared_ptr< Expression > expression
Expression that is being wrapped.
Definition: all.hpp:38249
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5046
const std::shared_ptr< Number > & get_min() const noexcept
Getter for member variable NumberRange::min.
Definition: all.hpp:17638
UnaryOp get_value() const noexcept
Getter for member variable UnaryOperator::value.
Definition: all.hpp:18698
bool is_block_comment() const noexcept override
Check if the ast node is an instance of ast::BlockComment.
Definition: all.hpp:36338
StatementVector solve_statements
solve blocks to be called or generated
Definition: all.hpp:37130
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5026
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6269
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:33296
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8859
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:39038
bool is_expression() const noexcept override
Check if the ast node is an instance of ast::Expression.
Definition: all.hpp:423
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12738
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32139
virtual Number * clone() const override
Return a copy of the current node.
Definition: all.hpp:982